Submission #2699406
Source Code Expand
#define _GLIBCXX_DEBUG #include <iostream> #include <cstdio> #include <cmath> #include <string> #include <vector> #include <utility> #include <algorithm> #include <map> #include <queue> #include <bitset> #include <stack> typedef long long ll; typedef std::vector< int > VI; const double EPS = 1e-10; const double PI = acos(-1); const ll INF = 1 << 30; int main(int argc, char* argv[]) { int n; std::cin >> n; std::vector< std::string > vs(n, ""); for (int i = 0; i < n; i++) { std::cin >> vs[i]; std::sort(vs[i].begin(), vs[i].end()); } std::vector< std::string::iterator > vit(n); for (int i = 0; i < n; i++) { vit[i] = vs[i].begin(); } std::string ans = ""; std::string::iterator it; for (it = vs[0].begin(); it != vs[0].end(); it++) { int cnt = 1; for (int i = 1; i < n; i++) { std::string::iterator it2; while(vit[i] != vs[i].end()) { if (*it > *vit[i]) { vit[i]++; } else { if (*it == *(vit[i])) { cnt++; vit[i]++; } break; } } } if (cnt == n) { ans.push_back(*it); } } std::cout << ans << std::endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Dubious Document |
User | tttaki |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1205 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 2 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 |