Submission #1208394


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, 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 0
Code Size 828 Byte
Status
Exec Time 1 ms
Memory 128 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);
                      ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 0 / 300 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 1 ms 128 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