답안 #876622

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
876622 2023-11-22T05:57:17 Z quocbaoo Vlak (COCI20_vlak) C++14
0 / 70
8 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++){
      |                ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -