# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1006575 | 2024-06-24T03:54:39 Z | vjudge1 | Vlak (COCI20_vlak) | C++17 | 20 ms | 61688 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, m, sz = 1, nxt[3][N][26], lvl; bool win[N]; void add(string s, int id){ int cur = 0; for (int i = 0; i < s.size(); i ++){ char c = s[i]; int e = s[i] - 'a'; if (nxt[2][cur][e] == -1){ nxt[2][cur][e] = sz; nxt[id][cur][e] = sz; sz++; } else nxt[id][cur][e] = nxt[2][cur][e]; // cout << cur << " -- " << c << " -- "; cur = nxt[2][cur][e]; // cout << cur << endl; } } void dfs(int v){ bool leaf = 1; for (int e = 0; e < 26; e ++){ if (nxt[2][v][e] == -1) continue; int u = nxt[2][v][e]; lvl++; dfs(u); lvl++; if (nxt[lvl % 2][v][e] != -1){ leaf = 0; win[v] |= !win[u]; } } if (leaf) win[v] = 0; } int main(){ memset(nxt, -1, sizeof nxt); cin >> n; string s; for (int i = 0; i < n; i ++){ cin >> s; add(s, 0); } cin >> m; for (int i = 0; i < m; i ++){ cin >> s; add(s, 1); } dfs(0); cout << (win[0] ? "Nina" : "Emilija") << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 61276 KB | Output is correct |
2 | Correct | 8 ms | 61416 KB | Output is correct |
3 | Correct | 8 ms | 61276 KB | Output is correct |
4 | Correct | 7 ms | 61276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 61276 KB | Output is correct |
2 | Correct | 9 ms | 61400 KB | Output is correct |
3 | Correct | 8 ms | 61272 KB | Output is correct |
4 | Correct | 8 ms | 61276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 61276 KB | Output is correct |
2 | Correct | 8 ms | 61424 KB | Output is correct |
3 | Correct | 8 ms | 61272 KB | Output is correct |
4 | Correct | 9 ms | 61344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 61272 KB | Output is correct |
2 | Correct | 8 ms | 61356 KB | Output is correct |
3 | Correct | 8 ms | 61272 KB | Output is correct |
4 | Correct | 8 ms | 61276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 61688 KB | Output is correct |
2 | Correct | 20 ms | 61520 KB | Output is correct |
3 | Correct | 20 ms | 61532 KB | Output is correct |
4 | Correct | 20 ms | 61512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 61528 KB | Output is correct |
2 | Correct | 18 ms | 61512 KB | Output is correct |
3 | Correct | 18 ms | 61532 KB | Output is correct |
4 | Correct | 18 ms | 61600 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 61532 KB | Output is correct |
2 | Correct | 18 ms | 61532 KB | Output is correct |
3 | Correct | 18 ms | 61532 KB | Output is correct |
4 | Correct | 19 ms | 61532 KB | Output is correct |