# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1102105 |
2024-10-17T12:49:11 Z |
rayan_bd |
Vlak (COCI20_vlak) |
C++17 |
|
28 ms |
20560 KB |
#include <bits/stdc++.h>
using namespace std;
const vector<string> ans={"Emilija","Nina"};
struct Node
{
Node* child[26];
bool n,m;
Node(){
for(int i=0;i<26;++i) child[i]=0;
n=m=0;
}
};
Node* root = new Node();
struct Trie{
void add(string str,bool f){
Node* curr=root;
for(auto it:str){
if(curr->child[it-'a']==NULL) curr->child[it-'a']=new Node();
curr=curr->child[it-'a'],curr->n|=f,curr->m|=!f;
}
}
bool qry(Node* curr,bool f){
for(int i=0;i<26;++i){
if((curr->child[i]!=NULL&&curr->child[i]->n==f&&curr->child[i]->m==!f)||(curr->child[i]!=NULL&&curr->child[i]->n==curr->child[i]->m&&qry(curr->child[i],!f)==f)) return f;
}
return !f;
}
} tr;
signed main() {
int n;cin>>n;
string str;
for(int i=0;i<n;++i){
cin>>str;
tr.add(str,1);
}
cin>>n;
for(int i=0;i<n;++i){
cin>>str;
tr.add(str,0);
}
cout<<ans[tr.qry(root,1)];
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
764 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
760 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
19448 KB |
Output is correct |
2 |
Correct |
20 ms |
18004 KB |
Output is correct |
3 |
Correct |
18 ms |
17028 KB |
Output is correct |
4 |
Correct |
28 ms |
18588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
19540 KB |
Output is correct |
2 |
Correct |
22 ms |
20560 KB |
Output is correct |
3 |
Correct |
18 ms |
18772 KB |
Output is correct |
4 |
Correct |
18 ms |
19024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
18520 KB |
Output is correct |
2 |
Correct |
19 ms |
18008 KB |
Output is correct |
3 |
Correct |
21 ms |
18520 KB |
Output is correct |
4 |
Correct |
23 ms |
19592 KB |
Output is correct |