# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
520153 |
2022-01-28T14:47:32 Z |
AkiYuu |
Vlak (COCI20_vlak) |
C++17 |
|
10 ms |
9932 KB |
/*
Problems:
Author: AkiYuu
*/
#include <bits/stdc++.h>
#define task "GROUP"
#define ll long long
#define ld long double
#define pb(u) emplace_back(u)
#define ffw(i,a,b) for (ll i = a; i <= b; i++)
#define fbw(i,b,a) for (ll i = b; i >= a; i--)
#define adj(v,adj,u) for (auto v : adj[u])
#define rep(i,a) for (auto i : a)
#define reset(a) memset(a, 0, sizeof(a))
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
using namespace std;
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
// freopen(task".inp", "r", stdin);
// freopen(task".out", "w", stdout);
}
const int mxn = 1e6 + 5;
typedef pair<ll, ll> ii;
int trie[2000005][26], dem = 0;
int can[2000005 * 26];
int n, m;
bool winner[2000005 * 26];
void add(string s, int col){
int node = 0;
for (char c : s){
int x = c - 'a';
can[node] |= ( 1 << col );
if (trie[node][x] == 0) {
trie[node][x] = ++dem;
}
node = trie[node][x];
}
}
int calc(int u, int player){
if( !(can[u] & ( 1 << player ) ) ) return 0;
ffw(i,0,25){
if ( trie[u][i] == 0) continue;
int v = trie[u][i];
if ( !calc(v, player ^ 1) ){
return 1;
}
}
return 0;
}
string ans[2] = {"Emilija", "Nina"};
void solve(){
cin >> n;
ffw(i,1,n){
string s;
cin >> s;
add(s,0);
}
cin >> m;
ffw(i,1,m){
string s;
cin >> s;
add(s,1);
}
cout << ans[calc(0,0) ]<< '\n';
}
int main(){
fastio();
int t = 1;
// cin >> t;
while (t--)
solve();
}
# |
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 |
Correct |
0 ms |
332 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 |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
9300 KB |
Output is correct |
2 |
Correct |
8 ms |
8652 KB |
Output is correct |
3 |
Correct |
8 ms |
8380 KB |
Output is correct |
4 |
Correct |
8 ms |
9292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
9420 KB |
Output is correct |
2 |
Correct |
8 ms |
9932 KB |
Output is correct |
3 |
Correct |
8 ms |
9164 KB |
Output is correct |
4 |
Correct |
10 ms |
9212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
8908 KB |
Output is correct |
2 |
Correct |
7 ms |
8780 KB |
Output is correct |
3 |
Correct |
8 ms |
9156 KB |
Output is correct |
4 |
Correct |
8 ms |
9724 KB |
Output is correct |