| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 725064 | Tsiannis | Vlak (COCI20_vlak) | C++17 | 54 ms | 88160 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 100000000007
#define maxn 200005
#define maxm 28
ll T1[maxn][maxm];
ll T2[maxn][maxm];
bool solve(ll nodeN, ll nodeE, bool turn){
if (turn==1&&nodeE==-1)
return 0;
if (turn==0&&nodeN==-1)
return 0;
if (!turn){
bool maxi=0;
for (char i='a';i<='z';i++){
if (T1[nodeN][i-'a']!=-1){
maxi=max(maxi,!solve(T1[nodeN][i-'a'],T2[nodeE][i-'a'],1));
}
}
return maxi;
}
else{
bool maxi=0;
for (char i='a';i<='z';i++){
if (T2[nodeE][i-'a']!=-1){
maxi=max(maxi,!solve(T1[nodeN][i-'a'],T2[nodeE][i-'a'],0));
}
}
return maxi;
}
}
int main()
{
memset(T1,-1,sizeof(T1));
memset(T2,-1,sizeof(T2));
ll n; cin>>n;
ll next=1;
while(n--){
string s; cin>>s;
ll i=0,v=0;
while(i<s.size()){
if (T1[v][s[i]-'a']==-1){
T1[v][s[i]-'a']=next;
v=next;
next++;
}
else
{
v=T1[v][s[i]-'a'];
}
++i;
}
}
next=1; cin>>n;
while(n--){
string s; cin>>s;
ll i=0,v=0;
while(i<s.size()){
if (T2[v][s[i]-'a']==-1){
T2[v][s[i]-'a']=next;
v=next;
next++;
}
else
{
v=T2[v][s[i]-'a'];
}
++i;
}
}
bool ans=solve(0,0,0);
if (ans)
cout<<"Nina"<<endl;
else
cout<<"Emilija"<<endl;
return 0;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
