# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1056956 |
2024-08-13T12:41:31 Z |
anarch_y |
Vlak (COCI20_vlak) |
C++17 |
|
4 ms |
8028 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
#define pb push_back
const int mod = 1e9+7;
struct Trie{
static const int wmax = 2e6;
int trie[wmax][26];
bool stop[wmax];
int num;
void insert(string x){
int cur = 0;
for(auto t: x){
int c = t - 'a';
if(trie[cur][c] == 0){
trie[cur][c] = ++num;
}
cur = trie[cur][c];
}
stop[cur] = true;
}
pair<int, int> check(string x){
int cur = 0;
int ans = 0;
for(auto t: x){
int c = t - 'a';
if(trie[cur][c] == 0){
if(stop[cur]) return {ans, 1};
else return {ans, 0};
}
ans++;
cur = trie[cur][c];
}
if(stop[cur]) return {ans, 1};
else return {ans, 0};
}
};
Trie T;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<string> v(n);
for(int i=0; i<n; i++) cin >> v[i];
int m; cin >> m;
vector<string> w(m);
for(int i=0; i<m; i++){
cin >> w[i];
T.insert(w[i]);
}
bool ok = false;
for(int i=0; i<n; i++){
auto [ans, b] = T.check(v[i]);
if(ans%2 == 0){
if(sz(v[i]) != ans){
ok = true;
break;
}
}
else{
if(b == 1){
ok = true;
break;
}
}
}
if(ok) cout << "Nina";
else cout << "Emilija";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2512 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2440 KB |
Output is correct |
4 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8028 KB |
Output is correct |
2 |
Incorrect |
3 ms |
7772 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
7772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
7772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |