# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
993815 |
2024-06-06T12:52:28 Z |
KawakiMeido |
Vlak (COCI20_vlak) |
C++17 |
|
73 ms |
125268 KB |
/*Author: KawakiMeido*/
#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
/*Constants*/
const int N = 2e5+10;
const int INF = 1e9+7;
const long long LLINF = 1e18+3;
/*TestCases*/
int test=1;
void solve();
void TestCases(bool v){
if (v) cin >> test;
while(test--) solve();
}
/*Global Variables*/
int n,m;
bool exist[26];
vector<int> a[N][26];
bool vis[N][26];
bool ans[N][26];
bool DFS(int i, int f){
bool res = true;
for (auto idx:a[i][f]){
if (vis[i+1][idx]) res = (res && (!ans[i+1][idx]));
else res = (res && (!DFS(i+1,idx)));
}
vis[i][f] = true;
ans[i][f] = res;
// cout << i << " " << char(f+'a') << " " << res << endl;
return res;
}
/*Solution*/
void solve(){
string s;
cin >> n;
for (int i=1; i<=n; i++){
cin >> s;
exist[s[0]-'a'] = true;
for (int j=1; j<(int)s.size(); j++){
if (j%2==0){
a[j-1][s[j-1]-'a'].push_back(s[j]-'a');
}
}
}
cin >> m;
for (int i=1; i<=m; i++){
cin >> s;
for (int j=0; j<(int)s.size(); j++){
if (j%2){
a[j-1][s[j-1]-'a'].push_back(s[j]-'a');
}
}
}
bool verify = 0;
for (int i=0; i<26; i++){
if (exist[i]){
verify = (DFS(0,i) || verify);
}
}
if (verify) cout << "Nina" << endl;
else cout << "Emilija" << endl;
}
/*Driver Code*/
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
TestCases(0);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
124336 KB |
Output is correct |
2 |
Correct |
48 ms |
124252 KB |
Output is correct |
3 |
Correct |
50 ms |
124244 KB |
Output is correct |
4 |
Correct |
49 ms |
122552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
124336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
124312 KB |
Output is correct |
2 |
Correct |
49 ms |
124244 KB |
Output is correct |
3 |
Correct |
50 ms |
124244 KB |
Output is correct |
4 |
Correct |
73 ms |
124244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
122592 KB |
Output is correct |
2 |
Correct |
70 ms |
124332 KB |
Output is correct |
3 |
Correct |
66 ms |
124244 KB |
Output is correct |
4 |
Correct |
70 ms |
124200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
123472 KB |
Output is correct |
2 |
Incorrect |
71 ms |
123304 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
125268 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
125136 KB |
Output is correct |
2 |
Incorrect |
53 ms |
125084 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |