# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1108924 | 2024-11-05T16:54:49 Z | themaver1cks | Vlak (COCI20_vlak) | C++14 | 24 ms | 24648 KB |
/** 。∠(*・ω・)っ ⌒ 由 ~ (( ,,・з・,, )) _Π_____。 /______/~\ | 田田|門| > love miku so muchhhh <3 **/ #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define sz(x) (int)(x).size() #define el "\n" typedef long long ll; typedef pair<int,int> pii; typedef double db; // var dec int n, m; // ds dec // struct Trie { struct Node { Node* child[26]; vector <int> color; Node() { for (int i=0; i<26; ++i) child[i] = NULL; color.resize(2, 0); } }; Node* root; int cur; Trie(): cur(0) { root = new Node(); } // void add_string(string s, bool is_blue) { Node* p = root; for (auto x: s) { int c = x-'a'; if (p->child[c] == NULL) p->child[c] = new Node(); p = p->child[c]; p->color[is_blue]++; } } // bool calc(Node* p, bool is_blue) { bool no_child = 1, win = 0; for (int c=0; c<26; ++c) { if (p->child[c] != NULL) no_child = 0; if (p->child[c] != NULL && p->child[c]->color[is_blue] != 0) { // cout << c << el; if (is_blue) win |= calc(p->child[c], is_blue^1); else win |= !(calc(p->child[c], is_blue^1)); // win |= !(calc(p->child[c], is_blue^1)); } } // cout << no_child << " " << win << " " << is_blue << el; if (no_child && p->color[is_blue]) return !is_blue; if (win) return is_blue; else return !is_blue; } // bool call_func() { Node* p = root; bool win = 0; for (int c=0; c<26; ++c) { if (p->child[c] != NULL && p->child[c]->color[1] > 0) { bool temp = calc(p->child[c], 0); // cout << c << " " << temp << el << el; win |= temp; } } return win; } } trie; // void solve() { cin >> n; for (int i=1; i<=n; ++i) { string s; cin >> s; trie.add_string(s, 1); } cin >> m; for (int i=1; i<=m; ++i) { string s; cin >> s; trie.add_string(s, 0); } cout << (trie.call_func() ? "Nina" : "Emilija") << el; } // int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); if (fopen("lmao.inp", "r")) { freopen("lmao.inp", "r", stdin); freopen("lmao.out", "w", stdout); } int t = 1; // cin >> t; while (t--) solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 592 KB | Output is correct |
2 | Correct | 1 ms | 592 KB | Output is correct |
3 | Correct | 1 ms | 592 KB | Output is correct |
4 | Correct | 1 ms | 592 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 592 KB | Output is correct |
2 | Correct | 1 ms | 716 KB | Output is correct |
3 | Correct | 1 ms | 592 KB | Output is correct |
4 | Correct | 1 ms | 592 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 764 KB | Output is correct |
2 | Correct | 1 ms | 592 KB | Output is correct |
3 | Correct | 1 ms | 592 KB | Output is correct |
4 | Correct | 1 ms | 816 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 592 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 592 KB | Output is correct |
4 | Correct | 1 ms | 592 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 22992 KB | Output is correct |
2 | Correct | 21 ms | 21584 KB | Output is correct |
3 | Correct | 20 ms | 20624 KB | Output is correct |
4 | Correct | 24 ms | 22748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 23376 KB | Output is correct |
2 | Correct | 23 ms | 24648 KB | Output is correct |
3 | Correct | 20 ms | 22648 KB | Output is correct |
4 | Correct | 21 ms | 23052 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 22096 KB | Output is correct |
2 | Correct | 22 ms | 21584 KB | Output is correct |
3 | Correct | 22 ms | 22440 KB | Output is correct |
4 | Correct | 24 ms | 23852 KB | Output is correct |