# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
520140 |
2022-01-28T14:27:24 Z |
AkiYuu |
Vlak (COCI20_vlak) |
C++17 |
|
0 ms |
0 KB |
/*
Problems:
Author: AkiYuu
*/
#include <bits/stdc++.h>
#define task "GROUP"
#define ll long long
#define ld long double
#define pb(u) emplace_back(u)
#define ffw(i,a,b) for (ll i = a; i <= b; i++)
#define fbw(i,b,a) for (ll i = b; i >= a; i--)
#define adj(v,adj,u) for (auto v : adj[u])
#define rep(i,a) for (auto i : a)
#define reset(a) memset(a, 0, sizeof(a))
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
using namespace std;
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
// freopen(task".inp", "r", stdin);
// freopen(task".out", "w", stdout);
}
const int mxn = 1e6 + 5;
typedef pair<ll, ll> ii;
int trie[2000005][26], dem = 0;
int can[20000005 * 26];
int n, m;
bool winner[2000005 * 26];
void add(string s, int col){
int node = 0;
for (char c : s){
int x = c - 'a';
if (trie[node][x] == 0) {
trie[node][x] = ++dem;
}
can[dem] |= ( 1 << col );
node = trie[node][x];
}
}
void dfs(int u, int player){
winner[u] = 1;
bool temp = 0;
ffw(i,0,25){
if ( trie[u][i] == 0) continue;
if ( can[trie[u][i] ] & ( 1 << (player^1)) ){
dfs(trie[u][i], player ^ 1);
winner[u] &= (winner[ trie[u][i] ] ^ 1);
}
}
}
string ans[2] = {"Nina", "Emilija"};
void solve(){
cin >> n;
ffw(i,1,n){
string s;
cin >> s;
add(s,0);
}
cin >> m;
ffw(i,1,m){
string s;
cin >> s;
add(s,1);
}
dfs(0,1);
cout << ans[winner[0] ]<< '\n';
}
int main(){
fastio();
int t = 1;
// cin >> t;
while (t--)
solve();
}
Compilation message
Main.cpp: In function 'void dfs(int, int)':
Main.cpp:53:10: warning: unused variable 'temp' [-Wunused-variable]
53 | bool temp = 0;
| ^~~~
/tmp/ccbqKW11.o: in function `fastio()':
Main.cpp:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x13d): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/ccbqKW11.o: in function `solve()':
Main.cpp:(.text+0x2a0): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x2f6): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x389): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x3be): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x460): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/ccbqKW11.o: in function `main':
Main.cpp:(.text.startup+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x1d): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/ccbqKW11.o: in function `_GLOBAL__sub_I__Z6fastiov':
Main.cpp:(.text.startup+0x49): relocation truncated to fit: R_X86_64_PC32 against `.bss'
Main.cpp:(.text.startup+0x7e): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status