# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
863004 | 2023-10-19T12:55:18 Z | duckindog | Vlak (COCI20_vlak) | C++14 | 31 ms | 113500 KB |
// from duckindog wth depression #include<bits/stdc++.h> using namespace std; const int N = 8 * (2e5 + 10); string a[N], b[N]; int nwt[N][27]; int st[N]; int it, bit; void add(string x, int y) { int g = 0; for (auto ch : x) { st[g] |= y; int w = ch - 'a' + 1; if (!nwt[g][w]) nwt[g][w] = ++it; g = nwt[g][w]; } st[g] |= y; return; } void dfs(int g = 0) { for (int i = 0; i <= 26; ++i) { if (!nwt[g][i]) continue; char ni = !i ? '0' : char(i + 'a' - 1); cout << g << " " << nwt[g][i] << " " << ni << "\n"; dfs(nwt[g][i]); } return; } bool check(int g = 0, bool y = 0) { bool w = 0; for (int i = 1; i <= 26; ++i) { bool ny = 1 - y; bool trapdoor = 0; int v = nwt[g][i]; if (ny && st[v] % 2 == 1) trapdoor = 1; if (!ny && st[v] >= 2) trapdoor = 1; if (!v || !trapdoor) continue; w = 1; if (!y && check(v, ny)) return 1; if (y && !check(v, ny)) return 0; } return y; } int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("duck.inp", "r")) { freopen("duck.inp", "r", stdin); freopen("duck.out", "w", stdout); } int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i], bit = max(bit, int(a[i].size())); int m; cin >> m; for (int i = 1; i <= m; ++i) cin >> b[i], bit = max(bit, int(b[i].size())); for (int i = 1; i <= n; ++i) add(a[i], 1); for (int i = 1; i <= m; ++i) add(b[i], 2); cout << (check() ? "Nina" : "Emilija"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 101340 KB | Output is correct |
2 | Correct | 22 ms | 101580 KB | Output is correct |
3 | Correct | 21 ms | 101376 KB | Output is correct |
4 | Correct | 20 ms | 101536 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 101468 KB | Output is correct |
2 | Correct | 20 ms | 101416 KB | Output is correct |
3 | Correct | 20 ms | 101468 KB | Output is correct |
4 | Correct | 20 ms | 101348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 101468 KB | Output is correct |
2 | Correct | 20 ms | 101468 KB | Output is correct |
3 | Correct | 20 ms | 101544 KB | Output is correct |
4 | Correct | 21 ms | 101468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 101524 KB | Output is correct |
2 | Correct | 20 ms | 101468 KB | Output is correct |
3 | Correct | 21 ms | 101464 KB | Output is correct |
4 | Correct | 21 ms | 101392 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 113224 KB | Output is correct |
2 | Correct | 27 ms | 112472 KB | Output is correct |
3 | Correct | 28 ms | 111964 KB | Output is correct |
4 | Correct | 27 ms | 112824 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 113244 KB | Output is correct |
2 | Correct | 27 ms | 113500 KB | Output is correct |
3 | Correct | 26 ms | 112936 KB | Output is correct |
4 | Correct | 26 ms | 112976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 112824 KB | Output is correct |
2 | Correct | 27 ms | 112468 KB | Output is correct |
3 | Correct | 27 ms | 112844 KB | Output is correct |
4 | Correct | 31 ms | 113244 KB | Output is correct |