Submission #1370997


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#define pb push_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[(sz(V)-2)])
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (1100000099)
#define INFLL (1100000000000000099ll)
#define MOD (1000000007)
#define MAXN (55)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;

string S;
char str[MAXN][55];
int cnt[MAXN][26];
int N;

int main() {
	scanf("%d", &N);
	for(int i = 1; i <= N; i++) scanf(" %s", str[i]);
	for(int i = 1; i <= N; i++) for(int j = 0; str[i][j]; j++)
		cnt[i][str[i][j] - 'a']++;
	for(int i = 2; i <= N; i++) for(int j = 0; j < 26; j++)
		upmin(cnt[1][j], cnt[i][j]);
	for(int i = 0; i < 26; i++) for(int j = 0; j < cnt[1][i]; j++)
		S += ('a' + i);
	if(S.empty()) { putchar(' '); return 0; }
	puts(S.c_str());
	return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:45:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
./Main.cpp:46:50: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1; i <= N; i++) scanf(" %s", str[i]);
                                                  ^

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