# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
934391 |
2024-02-27T09:22:48 Z |
bashNewbie |
Vlak (COCI20_vlak) |
C++17 |
|
10 ms |
10840 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define fast_io ios::sync_with_stdio(0), cin.tie(0)
#define vi vector<int>
const int N = 2e5+7, K = 26;
int adj[2][N][K], ctr[2];
void add(string& s, int d) {
int x = 0;
for(char ch: s) {
int c = ch-'a', y = adj[d][x][c];
if(!y) adj[d][x][c] = ++ctr[d];
x = adj[d][x][c];
}
}
int dfs(int x, int d) {
int wx = 0;
for(int y: adj[d][x]) {
if(!y) continue;
wx |= dfs(y, d^1)^1;
}
return wx;
}
int main() {
fast_io;
int n; string s;
for(int k = 0; k < 2; k++) {
cin >> n;
for(int i = 0; i < n; i++) {
cin >> s;
add(s, k);
}
}
int ret = dfs(0, 0);
cout << (ret? "Nina": "Emilija") << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Incorrect |
0 ms |
604 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
10076 KB |
Output is correct |
2 |
Incorrect |
8 ms |
9496 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
10332 KB |
Output is correct |
2 |
Correct |
7 ms |
10840 KB |
Output is correct |
3 |
Correct |
7 ms |
10076 KB |
Output is correct |
4 |
Correct |
9 ms |
10076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
9820 KB |
Output is correct |
2 |
Correct |
9 ms |
9564 KB |
Output is correct |
3 |
Incorrect |
10 ms |
9904 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |