# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1006562 | vjudge1 | Vlak (COCI20_vlak) | C++17 | 21 ms | 20496 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
string ans[] = {"Emilija", "Nina"};
struct node
{
node *ch[26];
bool f, s;
bool fw, sw;
node()
{
f = fw = s = sw = false;
for(int i = 0; i < 26; i++) ch[i] = NULL;
}
void insert(string &t, bool fir, int i = 0)
{
f |= fir;
s |= (!fir);
if(i == t.size()) return;
int c = t[i] - 'a';
if(ch[c] == NULL)
ch[c] = new node();
ch[c] -> insert(t, fir, i + 1);
}
void compute()
{
bool leaf = true;
for(int i = 0; i < 26; i ++)
if(ch[i] != NULL)
{
leaf = false;
ch[i] -> compute();
fw |= !ch[i]->sw;
sw |= !ch[i]->fw;
}
if(!f) fw = false;
if(!s) sw = false;
if(leaf) fw = sw = false;
}
};
node *root = new node();
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i ++)
{
string s;
cin >> s;
root -> insert(s, true);
}
cin >> n;
for(int i = 0; i < n; i ++)
{
string s;
cin >> s;
root -> insert(s, false);
}
root -> compute();
cout << ans[root -> fw] << endl;
return 0;
}
컴파일 시 표준 에러 (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... |