Submission #1210845


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
}
template<class S, class T> inline void chmin(S &a, T b){
  if(a>b){
    a=b;
  }
}
int main(){
  char S[55];
  int N, hist[26], i, j, len, res[26];
  {
    int Lj4PdHRW;
    for(Lj4PdHRW= 0;Lj4PdHRW< (25) + 1;Lj4PdHRW++){
      res[Lj4PdHRW] = 100;
    }
  }
  rd(N);
  while(N--){
    rd(S);
    len = strlen(S);
    {
      int KL2GvlyY;
      for(KL2GvlyY= 0;KL2GvlyY< (len-1) + 1;KL2GvlyY++){
        S[KL2GvlyY] -= 'a';
      }
    }
    {
      int Q5VJL1cS;
      for(Q5VJL1cS= 0;Q5VJL1cS< (25) + 1;Q5VJL1cS++){
        hist[Q5VJL1cS] = 0;
      }
    }
    {
      int e98WHCEY;
      for(e98WHCEY= 0;e98WHCEY< (len-1) + 1;e98WHCEY++){
        hist[S[e98WHCEY]]++;
      }
    }
    {
      int cTE1_r3A;
      for(cTE1_r3A= 0;cTE1_r3A< (25) + 1;cTE1_r3A++){
        chmin(res[cTE1_r3A], hist[cTE1_r3A]);
      }
    }
  }
  for(i=0;i<26;i++){
    for(j=0;j<res[i];j++){
      putchar_unlocked('a'+i);
    }
  }
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20170408-3

// --- original code ---
// {
//   int N;
//   char S[55];
//   
//   int res[26], hist[26];
//   int i, j, len;
// 
//   res[0..25] = 100;
//   rd(N);
//   while(N--){
//     rd(S);
//     len = strlen(S);
//     S[0..len-1] -= 'a';
//     hist[0..25] = 0;
//     hist[S[0..len-1]]++;
//     res[0..25] <?= hist[0..];
//   }
//   
// 
//   rep(i,26) rep(j,res[i]) putchar_unlocked('a'+i);
//   putchar_unlocked('\n');
// }

Submission Info

Submission Time
Task C - Dubious Document
User LayCurse
Language C++14 (GCC 5.4.1)
Score 300
Code Size 2198 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 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 AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
dec_half.txt AC 1 ms 256 KB
hand.txt AC 1 ms 256 KB
max.txt AC 1 ms 256 KB
max_10.txt AC 1 ms 256 KB
max_5.txt AC 1 ms 256 KB
maxx.txt AC 1 ms 256 KB
rnd.txt AC 1 ms 256 KB
single.txt AC 1 ms 256 KB