# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
632863 |
2022-08-21T02:07:02 Z |
van_hoang |
Vlak (COCI20_vlak) |
C++17 |
|
54 ms |
102924 KB |
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define debug(...) 86
#endif
const int maxN = 1e6 + 5;
int N, M, nxt = 1, mask[maxN][26], pS[maxN], pT[maxN], D[maxN];
queue<int> qu;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> N;
memset(mask, -1, sizeof mask);
for (int i = 0; i < N; ++i) {
string s; cin >> s;
int cur = 1;
for (auto &x : s) {
int j = x - 'a';
if (mask[cur][j] != -1) {
cur = mask[cur][j];
}
else {
mask[cur][j] = ++nxt;
cur = nxt;
}
pS[cur] = 1;
}
}
cin >> M;
for (int i = 0; i < M; ++i) {
string s; cin >> s;
int cur = 1;
for (auto &x : s) {
int j = x - 'a';
if (mask[cur][j] != -1) {
cur = mask[cur][j];
}
else {
mask[cur][j] = ++nxt;
cur = nxt;
}
pT[cur] = 1;
}
}
qu.emplace(1);
while (qu.size()) {
int u = qu.front(); qu.pop();
bool found = false;
for (int j = 0; j < 26; ++j) {
if (mask[u][j] != -1) {
if ((!D[u] && pS[mask[u][j]]) || (D[u] && pT[mask[u][j]])) {
found = true;
D[mask[u][j]] = D[u] ^ 1;
qu.emplace(mask[u][j]);
}
}
}
if (!found && D[u]) {
cout << "Nina\n";
return 0;
}
}
cout << "Emilija\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
102020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
102012 KB |
Output is correct |
2 |
Correct |
36 ms |
102060 KB |
Output is correct |
3 |
Correct |
42 ms |
102108 KB |
Output is correct |
4 |
Incorrect |
54 ms |
102068 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
102004 KB |
Output is correct |
2 |
Correct |
38 ms |
102120 KB |
Output is correct |
3 |
Incorrect |
38 ms |
102048 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
102100 KB |
Output is correct |
2 |
Correct |
38 ms |
102064 KB |
Output is correct |
3 |
Correct |
38 ms |
101996 KB |
Output is correct |
4 |
Incorrect |
41 ms |
102048 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
102836 KB |
Output is correct |
2 |
Incorrect |
41 ms |
102924 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
41 ms |
102856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
102792 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |