답안 #452051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
452051 2021-08-03T17:00:40 Z Apiram Vlak (COCI20_vlak) C++14
0 / 70
1000 ms 7648 KB
#include<bits/stdc++.h>
using namespace std;
int fi=0,sec=0;
void dfs(int i,vector<set<string>>&first,vector<set<string>>&second,string s){
	if (i==first.size()){
		return;
	}
	bool ok=false;
	if (i%2==0){
		for (auto x:first[i]){
			if (x.substr(0,x.length()-1)==s){
				ok=true;
				dfs(i+1,first,second,x);
			}
		}
		if (!ok){
			sec++;
			return;
		}
	}
	else{
		for(auto x:second[i]){
			if (x.substr(0,x.length()-1)==s){
				ok=true;
				dfs(i+1,first,second,x);
			}
		}
		if (!ok){
			fi++;
			return ;
		}
	}
}
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];
		if (j%2==0)
		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];
		if (j%2==1)
		second[j].insert(s);
	}
}
dfs(0,first,second,"");
if (fi>sec){
	cout<<"Nina\n";
}
else {
	cout<<"Emilija\n";
}

return 0;}

Compilation message

Main.cpp: In function 'void dfs(int, std::vector<std::set<std::__cxx11::basic_string<char> > >&, std::vector<std::set<std::__cxx11::basic_string<char> > >&, std::string)':
Main.cpp:5:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::set<std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 |  if (i==first.size()){
      |      ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 2 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1081 ms 5608 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 7648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1096 ms 6208 KB Time limit exceeded
2 Halted 0 ms 0 KB -