# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
377831 | 2021-03-15T08:17:25 Z | kshitij_sodani | Vlak (COCI20_vlak) | C++14 | 20 ms | 10860 KB |
//#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define a first #define b second #define endl '\n' int n,m; int pre[200001][26]; int val[200001][2]; int dp[200001]; int co=0; void insert(string s,int ii){ int cur=0; for(int i=0;i<s.size();i++){ if(pre[cur][s[i]-'a']==0){ co++; pre[cur][s[i]-'a']=co; } cur=pre[cur][s[i]-'a']; val[cur][ii]++; } } void dfs(int no,int lev=0){ if(lev%2==0){ dp[no]=0; for(int j=0;j<26;j++){ if(pre[no][j]>0){ //cout<<no<<":"<<pre[no][j]<<":"<<j<<endl; dfs(pre[no][j],lev+1); if(val[pre[no][j]][0]>0){ dp[no]|=(1-dp[pre[no][j]]); } } } } else{ dp[no]=0; for(int j=0;j<26;j++){ if(pre[no][j]>0){ //cout<<no<<":"<<pre[no][j]<<":"<<j<<endl; dfs(pre[no][j],lev+1); if(val[pre[no][j]][1]>0){ dp[no]|=(1-dp[pre[no][j]]); } } } } // cout<<no<<",,"<<dp[no]<<endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n; for(int i=0;i<n;i++){ string s; cin>>s; insert(s,0); } cin>>m; for(int i=0;i<m;i++){ string s; cin>>s; insert(s,1); } dfs(0); if(dp[0]){ cout<<"Nina"<<endl; } else{ cout<<"Emilija"<<endl; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 620 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 2 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 10148 KB | Output is correct |
2 | Correct | 19 ms | 9580 KB | Output is correct |
3 | Correct | 20 ms | 9068 KB | Output is correct |
4 | Correct | 19 ms | 9964 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 10476 KB | Output is correct |
2 | Correct | 17 ms | 10860 KB | Output is correct |
3 | Correct | 20 ms | 10092 KB | Output is correct |
4 | Correct | 18 ms | 10348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 9964 KB | Output is correct |
2 | Correct | 17 ms | 9580 KB | Output is correct |
3 | Correct | 17 ms | 9836 KB | Output is correct |
4 | Correct | 18 ms | 10476 KB | Output is correct |