Submission #876623

# Submission time Handle Problem Language Result Execution time Memory
876623 2023-11-22T06:03:53 Z quocbaoo Vlak (COCI20_vlak) C++14
0 / 70
7 ms 2648 KB
#include<bits/stdc++.h>
using namespace std;
bool kt=false;vector<pair<char,int> > v[140],v1[140];
void dfs(char k,int u){
	if (kt==true) return;
	//cout<<k;
	if (u%2==1){
		int d=0;
		for (int j=0;j<v1[int(k)].size();j++) {
			if (v1[int(k)][j].second==u+1) d++,dfs(v1[int(k)][j].first,u+1);
		}
		if (d==0) {
			kt=true;return;
		}
	}
	else{
		if (v[int(k)].size()==0) return;
		for (int j=0;j<v[int(k)].size();j++){
			if (v[int(k)][j].second==u+1) dfs(v[int(k)][j].first,u+1);
		}
	}
}
int main(){
	int n;cin>>n;bool mp[140]={};
	for (int i=1;i<=n;i++){
		string s;cin>>s;mp[int(s[0])]=true;
		for (int j=0;j<s.size()-1;j++){
			v[int(s[j])].push_back({s[j+1],j+2});
		}
	}
	int m;cin>>m;
	for (int i=1;i<=m;i++){
		string s1;cin>>s1;
		for (int j=0;j<s1.size()-1;j++){
			v1[int(s1[j])].push_back({s1[j+1],j+2});
		}
	}
	for (char c='a';c<='z';c++){
		if (mp[int(c)]==true) dfs(c,1);
		if (kt==true) {
			cout<<"Nina";return 0;
		}
	}
	cout<<"Emilija";
}

Compilation message

Main.cpp: In function 'void dfs(char, int)':
Main.cpp:9:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<char, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for (int j=0;j<v1[int(k)].size();j++) {
      |                ~^~~~~~~~~~~~~~~~~~
Main.cpp:18:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<char, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for (int j=0;j<v[int(k)].size();j++){
      |                ~^~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:27:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for (int j=0;j<s.size()-1;j++){
      |                ~^~~~~~~~~~~
Main.cpp:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for (int j=0;j<s1.size()-1;j++){
      |                ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 756 KB Output is correct
2 Correct 0 ms 448 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2396 KB Output is correct
2 Incorrect 7 ms 2648 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -