| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 844760 | vjudge1 | Vlak (COCI20_vlak) | C++17 | 17 ms | 22428 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 998244353;
const ll MAXN = 5005;
struct Node {
Node *to[26];
};
bool dfs(Node *nodeF, Node *nodeS, int turn) {
if (turn == 0) {
for (int i = 0; i < 26; i++) {
if (nodeF->to[i] != NULL && nodeS->to[i] == NULL)
return true;
}
for (int i = 0; i < 26; i++) {
if (nodeF->to[i] != NULL) {
bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn);
if (!Q)
return true;
}
}
return false;
} else {
for (int i = 0; i < 26; i++) {
if (nodeS->to[i] != NULL && nodeF->to[i] == NULL)
return true;
}
for (int i = 0; i < 26; i++) {
if (nodeS->to[i] != NULL) {
bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn);
if (!Q)
return true;
}
}
return false;
}
}
int main() {
fast
int n;
cin >> n;
Node *root1 = new Node();
Node *root2 = new Node();
for (int i = 0; i < n; i++) {
string s;
cin >> s;
Node *now = root1;
for (int j = 0; j < s.length(); j++) {
int t = s[j] - 'a';
if (now->to[t] == NULL)
now->to[t] = new Node();
now = now->to[t];
}
}
int m;
cin >> m;
for (int i = 0; i < m; i++) {
string s;
cin >> s;
Node *now = root2;
for (int j = 0; j < s.length(); j++) {
int t = s[j] - 'a';
if (now->to[t] == NULL)
now->to[t] = new Node();
now = now->to[t];
}
}
if (dfs(root1, root2, 0))
cout << "Nina\n";
else
cout << "Emilija\n";
}
컴파일 시 표준 에러 (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... | ||||
