Submission #876622

#TimeUsernameProblemLanguageResultExecution timeMemory
876622quocbaooVlak (COCI20_vlak)C++14
0 / 70
8 ms2648 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...