# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
500145 |
2021-12-30T11:35:45 Z |
Mounir |
Vlak (COCI20_vlak) |
C++14 |
|
31 ms |
19572 KB |
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define x first
#define y second
#define int long long
using namespace std;
const int N = 1e6, root = 1;
int fils[N][26];
int nNoeuds;
bool gagnant[N][2], estFin[N][2];
void ajouter(string line, int iJoueur){
int noeud = root;
for (int i = 0; i < (int)line.length(); ++i){
int cara = line[i] - 'a';
if (fils[noeud][cara] == 0)
fils[noeud][cara] = nNoeuds++;
noeud = fils[noeud][cara];
estFin[noeud][iJoueur] = true;
}
}
signed main(){
nNoeuds = 2;
for (int iJoueur = 0; iJoueur < 2; ++iJoueur){
int nMots; cin >> nMots;
vector<string> mots(nMots);
for (string& mot : mots){
cin >> mot;
ajouter(mot, iJoueur);
}
}
gagnant[0][0] = gagnant[0][1] = true;
for (int noeud = nNoeuds - 1; noeud > 0; --noeud){
gagnant[noeud][0] = gagnant[noeud][1] = false;
for (int c = 0; c < 26; ++c){
gagnant[noeud][0] |= !gagnant[fils[noeud][c]][1];
gagnant[noeud][1] |= !gagnant[fils[noeud][c]][0];
}
for (int i = 0; i < 2; ++i)
gagnant[noeud][i] |= (estFin[noeud][i] && !estFin[noeud][1 - i]);
}
if (gagnant[1][0])
cout << "Nina" << endl;
else
cout << "Emilija" << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
428 KB |
Output is correct |
2 |
Correct |
1 ms |
552 KB |
Output is correct |
3 |
Correct |
1 ms |
452 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
588 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
420 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is 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 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
18332 KB |
Output is correct |
2 |
Correct |
25 ms |
17328 KB |
Output is correct |
3 |
Correct |
23 ms |
16316 KB |
Output is correct |
4 |
Correct |
24 ms |
18052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
18768 KB |
Output is correct |
2 |
Correct |
24 ms |
19572 KB |
Output is correct |
3 |
Correct |
22 ms |
17996 KB |
Output is correct |
4 |
Correct |
23 ms |
18252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
17740 KB |
Output is correct |
2 |
Correct |
31 ms |
17348 KB |
Output is correct |
3 |
Correct |
25 ms |
17820 KB |
Output is correct |
4 |
Correct |
27 ms |
18888 KB |
Output is correct |