# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
961966 | rnazymxan | Vlak (COCI20_vlak) | C++17 | 16 ms | 22620 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;
#define ll long long
void init_code(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
const int N = 1e5 + 11;
struct Node {
Node* node[26];
Node(){
for(int i = 0; i < 26; i++){
node[i] = NULL;
}
}
};
void add(Node* root, string s){
int ptr = 0;
int n = s.size();
while(ptr < n){
if(root->node[s[ptr] - 'a'] != NULL){
root = root->node[s[ptr] - 'a'];
}else{
root->node[s[ptr] - 'a'] = new Node();
root = root->node[s[ptr] - 'a'];
}
ptr++;
}
}
bool win(Node* trie1, Node* trie2){
for(int i = 0; i < 26; i++){
if(trie1->node[i] != NULL && trie2->node[i] == NULL){
return true;
}
}
bool hehe = false;
for(int i = 0; i < 26; i++){
if(trie1->node[i] != NULL){
hehe |= !win(trie2 -> node[i], trie1 -> node[i]);
}
}
return hehe;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// init_code();
int n;
string s;
cin >> n;
Node *trie1 = new Node();
Node *trie2 = new Node();
while(n--){
cin >> s;
add(trie1, s);
}
cin >> n;
while(n--){
cin >> s;
add(trie2, s);
}
if(win(trie1, trie2)){
cout << "Nina";
}else{
cout << "Emilija";
}
}
컴파일 시 표준 에러 (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... |