# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
390499 |
2021-04-16T08:11:51 Z |
ngpin04 |
Vlak (COCI20_vlak) |
C++14 |
|
11 ms |
10316 KB |
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int N = 2e5 + 5;
int ptr[2][N][26];
int n, node;
bool Win[N];
void add(string &s, int id) {
int cur = 0;
for (char c : s) {
int &p = ptr[id][cur][c - 'a'];
if (p == 0)
p = ++node;
cur = p;
}
}
bool solve(int i, int j, int cur) {
bool res = false;
for (int val = 0; val < 26; val++) {
int pcur = ptr[cur][i][val];
if (pcur == 0)
continue;
int pnxt = ptr[cur ^ 1][j][val];
if (pnxt == 0)
return true;
res |= !solve(pnxt, pcur, cur ^ 1);
}
return res;
}
void proc() { cout << (solve(0, 0, 0) ? ("Nina\n") : ("Emilịa\n")); }
void enter() {
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
add(s, 0);
}
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
add(s, 1);
}
}
void preproc() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("KARA.inp","r",stdin);
// freopen("KARA.out","w",stdout);
}
int main() {
preproc();
enter();
proc();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
464 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
10068 KB |
Output is correct |
2 |
Incorrect |
10 ms |
9516 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
10316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
9768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |