# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
704929 | 2023-03-03T06:54:22 Z | 1075508020060209tc | Vlak (COCI20_vlak) | C++14 | 27 ms | 20248 KB |
//#pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n;int m; int __id=1; int nxt[30][500005]; int vis[2][500005]; int visb[500005]; void insa(string s){ int nw=1; vis[0][nw]=1; for(int i=0;i<s.size();i++){ int v=s[i]-'a'; if(nxt[v][nw]==0){ nxt[v][nw]=++__id; } nw=nxt[v][nw]; vis[0][nw]=1; } } void insb(string s){ int nw=1; vis[1][nw]=1; for(int i=0;i<s.size();i++){ int v=s[i]-'a'; if(nxt[v][nw]==0){ nxt[v][nw]=++__id; } nw=nxt[v][nw]; vis[1][nw]=1; } } int dp[500005]; void dfs(int nw,int plyr){ dp[nw]=1; for(int i=0;i<=29;i++){ if(nxt[i][nw]==0){continue;} int v=nxt[i][nw]; if(vis[plyr^1][v]==0){continue;} dfs(v,plyr^1); if(dp[v]==1){ dp[nw]=0; } } } signed main(){ cin>>n; for(int i=1;i<=n;i++){ string s; cin>>s; insa(s); } cin>>m; for(int i=1;i<=m;i++){ string s; cin>>s; insb(s); } dfs(1,0); if(!dp[1]){ cout<<"Nina\n"; }else{ cout<<"Emilija"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 724 KB | Output is correct |
2 | Correct | 1 ms | 724 KB | Output is correct |
3 | Incorrect | 1 ms | 724 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 824 KB | Output is correct |
2 | Correct | 1 ms | 724 KB | Output is correct |
3 | Incorrect | 1 ms | 692 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 724 KB | Output is correct |
2 | Incorrect | 1 ms | 692 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 724 KB | Output is correct |
2 | Correct | 1 ms | 696 KB | Output is correct |
3 | Correct | 1 ms | 724 KB | Output is correct |
4 | Correct | 1 ms | 724 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 18976 KB | Output is correct |
2 | Incorrect | 25 ms | 17848 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 19420 KB | Output is correct |
2 | Incorrect | 22 ms | 20248 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 18432 KB | Output is correct |
2 | Incorrect | 22 ms | 17868 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |