# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
692135 | 2023-02-01T07:33:00 Z | Tien_Noob | Vlak (COCI20_vlak) | C++17 | 17 ms | 14624 KB |
//Make CSP great again //Vengeance #include <bits/stdc++.h> #define TASK "TESTCODE" using namespace std; struct Trie { struct node { int rep, child[26]; node() { rep = 0; memset(child, -1, sizeof(child)); } }; vector<node> tree; Trie() { tree.emplace_back(); } void add(string &s, int t) { int id = 0; for (char c : s) { int w = c - 'a'; if (tree[id].child[w] == -1) { tree[id].child[w] = tree.size(); tree.emplace_back(); } id = tree[id].child[w]; tree[id].rep |= (1 << t); } } bool DFS(int u, int t) { for (int c = 0; c < 26; ++ c) { int v = tree[u].child[c]; if (v == -1) { continue; } if (tree[v].rep == (1 << t)) { return true; } if (tree[v].rep == 3 && !DFS(v, t ^ 1)) { return true; } } return false; } } tree; void readinput(int t) { int n; cin >> n; while(n--) { string s; cin >> s; tree.add(s, t); } } void read() { readinput(0); readinput(1); } void solve() { cout << (tree.DFS(0, 0) ? "Nina" : "Emilija"); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); if (fopen(TASK".INP", "r")) { freopen(TASK".INP", "r", stdin); //freopen(TASK".OUT", "w", stdout); } int t = 1; bool typetest = false; if (typetest) { cin >> t; } for (int __ = 1; __ <= t; ++ __) { //cout << "Case " << __ << ": "; read(); solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 596 KB | Output is correct |
2 | Correct | 1 ms | 596 KB | Output is correct |
3 | Correct | 1 ms | 596 KB | Output is correct |
4 | Correct | 1 ms | 596 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 572 KB | Output is correct |
2 | Correct | 1 ms | 596 KB | Output is correct |
3 | Correct | 1 ms | 580 KB | Output is correct |
4 | Correct | 1 ms | 596 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Output is correct |
2 | Correct | 1 ms | 596 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 1 ms | 596 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Output is correct |
2 | Correct | 1 ms | 596 KB | Output is correct |
3 | Correct | 1 ms | 596 KB | Output is correct |
4 | Correct | 1 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 14532 KB | Output is correct |
2 | Correct | 14 ms | 14524 KB | Output is correct |
3 | Correct | 16 ms | 14524 KB | Output is correct |
4 | Correct | 15 ms | 14532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 14520 KB | Output is correct |
2 | Correct | 12 ms | 14532 KB | Output is correct |
3 | Correct | 13 ms | 14532 KB | Output is correct |
4 | Correct | 14 ms | 14444 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 14624 KB | Output is correct |
2 | Correct | 15 ms | 14532 KB | Output is correct |
3 | Correct | 13 ms | 14520 KB | Output is correct |
4 | Correct | 13 ms | 14532 KB | Output is correct |