# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
993810 |
2024-06-06T12:49:32 Z |
KawakiMeido |
Vlak (COCI20_vlak) |
C++17 |
|
49 ms |
125008 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;
vis[i][f] = 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)));
}
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 |
38 ms |
124240 KB |
Output is correct |
2 |
Correct |
38 ms |
124248 KB |
Output is correct |
3 |
Correct |
49 ms |
124304 KB |
Output is correct |
4 |
Correct |
46 ms |
124244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
124244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
124224 KB |
Output is correct |
2 |
Correct |
37 ms |
124204 KB |
Output is correct |
3 |
Correct |
38 ms |
124248 KB |
Output is correct |
4 |
Correct |
40 ms |
124288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
124336 KB |
Output is correct |
2 |
Correct |
39 ms |
124240 KB |
Output is correct |
3 |
Correct |
42 ms |
124240 KB |
Output is correct |
4 |
Correct |
41 ms |
124240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
124764 KB |
Output is correct |
2 |
Incorrect |
40 ms |
124756 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
42 ms |
124816 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
124760 KB |
Output is correct |
2 |
Incorrect |
41 ms |
125008 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |