Submission #1291475


Source Code Expand

/* vim:set foldmethod=marker: */
#include <bits/stdc++.h>
using namespace std;

//{{{
#define all(x) (x).begin(),(x).end()
#define REP(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define RREP(i,a,b) for(int i=(int)(a); i>=b; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef unsigned long long ull;

#define dump(x) (cerr << #x << "=" << x << endl)
template<class T> ostream& osContainer(ostream& os,T c) { os<<'[';for(decltype(c.begin()) it=c.begin();it!=c.end();it++)os<<*it<<',';os<<']';return os; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { return osContainer(os,v); }
template<class T> ostream& operator<<(ostream& os,const set<T>& s) { return osContainer(os,s); }
template<class T> ostream& operator<<(ostream& os,const multiset<T>& s) { return osContainer(os,s); }
template<class T,class S> ostream& operator<<(ostream& os,const map<T,S>& m) { return osContainer(os,m); }
template<class T,class S> ostream& operator<<(ostream& os,const multimap<T,S>& m) { return osContainer(os,m); }
template<class T1,class T2>
ostream& operator<<(ostream& os, const pair<T1,T2>& p){ os << '(' << p.first << ',' << p.second << ')'; return os; }

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};
//}}}

int mn[26];
int c[26];

void solve(){
    int n;
    cin >> n;

    rep(i, 26) mn[i] = 10000000;

    rep(i, n){
        string s;
        cin >> s;

        for(char ch : s) {
            c[ch-'a']++;
        }

        rep(j, 26) {
            mn[j] = min(c[j], mn[j]);
        }
        memset(c, 0, sizeof(c));
    }

    stringstream ss;
    rep(i, 26) {
        rep(j, mn[i]){
            char ch = i + 'a';
            ss << ch;
        }
    }

    cout << ss.str() << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(12);
    solve();
}

Submission Info

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

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 KiB
0_001.txt AC 1 ms 256 KiB
dec_half.txt AC 1 ms 256 KiB
hand.txt AC 1 ms 256 KiB
max.txt AC 1 ms 256 KiB
max_10.txt AC 1 ms 256 KiB
max_5.txt AC 1 ms 256 KiB
maxx.txt AC 1 ms 256 KiB
rnd.txt AC 1 ms 256 KiB
single.txt AC 1 ms 256 KiB