# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
425228 | 2021-06-12T16:25:46 Z | keta_tsimakuridze | Vlak (COCI20_vlak) | C++14 | 36 ms | 19224 KB |
#include<bits/stdc++.h> using namespace std; const int N=2e5+5; int aft[N][30],fix[N][2],cur,n,m; vector<int>V[N]; string s; void add(string s,int f){ int u = 0; for(int i=0;i<s.size();i++){ if(!aft[u][s[i]-'0']) { cur++; aft[u][s[i]-'0'] = cur; V[u].push_back(aft[u][s[i]-'0']); } u = aft[u][s[i]-'0']; fix[u][f] = 1; } } bool dfs(int u,int f) { int o = 0; //cout<< f << " "<< u << endl; if(!fix[u][f]) return 0; if(!fix[u][1-f]) return 1; for(int i=0;i<V[u].size();i++){ bool x = dfs(V[u][i],1^f); o|=x; // cout<<u<<" "<<f<<" "<<x<<endl; } return o^1; } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>s; add(s,0); } cout<<endl; cin>>m; for(int i=1;i<=m;i++){ cin>>s; add(s,1); } int x = 0; for(int i=0;i<V[0].size();i++) x|=dfs(V[0][i],0); if(x) cout<<"Nina"; else cout<<"Emilija"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5196 KB | Output is correct |
2 | Correct | 4 ms | 5196 KB | Output is correct |
3 | Correct | 4 ms | 5196 KB | Output is correct |
4 | Correct | 4 ms | 5068 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5132 KB | Output is correct |
2 | Correct | 4 ms | 5196 KB | Output is correct |
3 | Correct | 4 ms | 5068 KB | Output is correct |
4 | Correct | 4 ms | 5152 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5124 KB | Output is correct |
2 | Correct | 4 ms | 5120 KB | Output is correct |
3 | Correct | 4 ms | 5068 KB | Output is correct |
4 | Correct | 4 ms | 5068 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5068 KB | Output is correct |
2 | Correct | 4 ms | 5068 KB | Output is correct |
3 | Correct | 4 ms | 5068 KB | Output is correct |
4 | Correct | 4 ms | 5132 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 18124 KB | Output is correct |
2 | Correct | 31 ms | 17224 KB | Output is correct |
3 | Correct | 35 ms | 16664 KB | Output is correct |
4 | Correct | 30 ms | 17736 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 18648 KB | Output is correct |
2 | Correct | 27 ms | 19224 KB | Output is correct |
3 | Correct | 31 ms | 18176 KB | Output is correct |
4 | Correct | 26 ms | 18360 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 17780 KB | Output is correct |
2 | Correct | 30 ms | 17496 KB | Output is correct |
3 | Correct | 29 ms | 17756 KB | Output is correct |
4 | Correct | 36 ms | 18596 KB | Output is correct |