Submission #452057

# Submission time Handle Problem Language Result Execution time Memory
452057 2021-08-03T17:14:25 Z Apiram Vlak (COCI20_vlak) C++14
0 / 70
87 ms 14872 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;cin>>n;
vector<string>arr(n);
int maxxy=0,minny=0;
for (int i =0;i<n;++i){cin>>arr[i];minny=max(minny,(int)arr[i].length());}
int m;cin>>m;
vector<string>brr(m);
for (int j = 0;j<m;++j){
	cin>>brr[j];
	maxxy=max(maxxy,(int)brr[j].length());
}
vector<set<string>>first(min(maxxy,minny)+1),second(min(maxxy,minny)+1);
for (int i = 0;i<n;++i){
	string s;
	for (int j = 0;j<min((int)arr[i].length(),min(minny,maxxy)+1);++j){
		s+=arr[i][j];
		first[j].insert(s);
	}
}
for (int i = 0;i<m;++i){
	string s;
	for (int j = 0;j<min((int)brr[i].length(),min(minny,maxxy)+1);++j){
		s+=brr[i][j];
		second[j].insert(s);
	}
}
int ok=0;
int counts1=0,counts2=0;
for (int i = 0;i<min(minny,maxxy)+1;++i){
	if (i%2==0){
		for (auto x:first[i]){
			if (i==0||second[i-1].find(x.substr(0,x.length()-1))!=second[i-1].end())
			if (second[i].find(x)==second[i].end()){
				counts1++;
				
			}
		}
	}
	else{
		for (auto x:second[i]){
			if (first[i-1].find(x.substr(0,x.length()-1))!=first[i-1].end())
			if (first[i].find(x)==first[i].end()){
				counts2++;
				
			}
		}
	}
}

if (counts1>=counts2){
	cout<<"Nina\n";
}
else {
	cout<<"Emilija\n";
}

return 0;}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:31:5: warning: unused variable 'ok' [-Wunused-variable]
   31 | int ok=0;
      |     ^~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 73 ms 9728 KB Output is correct
2 Correct 75 ms 9676 KB Output is correct
3 Incorrect 87 ms 9552 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 68 ms 14104 KB Output is correct
2 Correct 74 ms 14872 KB Output is correct
3 Incorrect 65 ms 14092 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 11220 KB Output isn't correct
2 Halted 0 ms 0 KB -