# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844760 | 2023-09-05T20:03:11 Z | vjudge1 | Vlak (COCI20_vlak) | C++17 | 17 ms | 22428 KB |
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); #define s second #define f first typedef long long ll; const ll MOD = 998244353; const ll MAXN = 5005; struct Node { Node *to[26]; }; bool dfs(Node *nodeF, Node *nodeS, int turn) { if (turn == 0) { for (int i = 0; i < 26; i++) { if (nodeF->to[i] != NULL && nodeS->to[i] == NULL) return true; } for (int i = 0; i < 26; i++) { if (nodeF->to[i] != NULL) { bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn); if (!Q) return true; } } return false; } else { for (int i = 0; i < 26; i++) { if (nodeS->to[i] != NULL && nodeF->to[i] == NULL) return true; } for (int i = 0; i < 26; i++) { if (nodeS->to[i] != NULL) { bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn); if (!Q) return true; } } return false; } } int main() { fast int n; cin >> n; Node *root1 = new Node(); Node *root2 = new Node(); for (int i = 0; i < n; i++) { string s; cin >> s; Node *now = root1; for (int j = 0; j < s.length(); j++) { int t = s[j] - 'a'; if (now->to[t] == NULL) now->to[t] = new Node(); now = now->to[t]; } } int m; cin >> m; for (int i = 0; i < m; i++) { string s; cin >> s; Node *now = root2; for (int j = 0; j < s.length(); j++) { int t = s[j] - 'a'; if (now->to[t] == NULL) now->to[t] = new Node(); now = now->to[t]; } } if (dfs(root1, root2, 0)) cout << "Nina\n"; else cout << "Emilija\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 604 KB | Output is correct |
2 | Correct | 0 ms | 604 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 604 KB | Output is correct |
2 | Correct | 0 ms | 604 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 604 KB | Output is correct |
2 | Correct | 0 ms | 604 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 604 KB | Output is correct |
2 | Correct | 0 ms | 604 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 21084 KB | Output is correct |
2 | Correct | 12 ms | 19804 KB | Output is correct |
3 | Correct | 12 ms | 18524 KB | Output is correct |
4 | Correct | 13 ms | 20572 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 21340 KB | Output is correct |
2 | Correct | 13 ms | 22428 KB | Output is correct |
3 | Correct | 12 ms | 20728 KB | Output is correct |
4 | Correct | 12 ms | 20828 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 20316 KB | Output is correct |
2 | Correct | 12 ms | 19800 KB | Output is correct |
3 | Correct | 13 ms | 20316 KB | Output is correct |
4 | Correct | 15 ms | 21596 KB | Output is correct |