Submission #1209859


Source Code Expand

Copy
// AtCoder Regular Contest 071
// C - 怪文書 / Dubious Document

#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAX_N 50
#define ALPHABETS 26
using namespace std;
typedef long long int ll;


int N;
int cnt[ALPHABETS];

int main() {

  char s[MAX_N + 2];
  int tmp_count[ALPHABETS];

  scanf("%d", &N);
  fill(cnt, cnt + ALPHABETS, MAX_N);
  for (int i = 0; i < N; i++) {
    scanf("%*c%s", s);
    memset(tmp_count, 0, sizeof(tmp_count));
    for (int j = 0; j < strlen(s); j++) {
      tmp_count[s[j] - 'a']++;
    }
    for (int j = 0; j < ALPHABETS; j++) {
      cnt[j] = min(cnt[j], tmp_count[j]);
    }
  }

  for (int i = 0; i < ALPHABETS; i++) {
    for (int j = 0; j < cnt[i]; j++) {
      printf("%c", i + 'a');
    }
  }
  printf("\n");

  return 0;

}


Submission Info

Submission Time
Task C - Dubious Document
User scarlet7000
Language C++14 (GCC 5.4.1)
Score 300
Code Size 832 Byte
Status
Exec Time 3 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:21:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &N);
                  ^
./Main.cpp:24:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%*c%s", s);
                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
× 2
× 10
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, dec_half.txt, hand.txt, max.txt, max_10.txt, max_5.txt, maxx.txt, rnd.txt, single.txt
Case Name Status Exec Time Memory
0_000.txt 1 ms 128 KB
0_001.txt 1 ms 128 KB
dec_half.txt 1 ms 128 KB
hand.txt 3 ms 256 KB
max.txt 1 ms 128 KB
max_10.txt 1 ms 128 KB
max_5.txt 1 ms 128 KB
maxx.txt 1 ms 128 KB
rnd.txt 1 ms 128 KB
single.txt 1 ms 128 KB