Submission #383148

#TimeUsernameProblemLanguageResultExecution timeMemory
383148IwanttobreakfreeKartomat (COCI17_kartomat)C++98
72 / 80
1 ms364 KiB
#include <iostream> #include <vector> #include <string> using namespace std; int main(){ int n; string st; vector<bool> l(26,false); cin>>n; vector<string> str(n); for(int i=0;i<n;i++)cin>>str[i]; cin>>st; int k=st.length(); for(int i=0;i<n;i++){ bool pos=true; for(int j=0;j<k;j++){ if(str[i][j]!=st[j]){ pos=false; break; } if(str[i].length()>k&&pos)l[str[i][k]-'A']=true; } } cout<<"***"; for(int i=0;i<5;i++){ char c=i+'A'; if(l[i])cout<<c; else cout<<'*'; } cout<<'\n'; for(int i=5;i<13;i++){ char c=i+'A'; if(l[i])cout<<c; else cout<<'*'; } cout<<'\n'; for(int i=13;i<21;i++){ char c=i+'A'; if(l[i])cout<<c; else cout<<'*'; } cout<<'\n'; for(int i=21;i<26;i++){ char c=i+'A'; if(l[i])cout<<c; else cout<<'*'; } cout<<"***"; cout<<'\n'; }

Compilation message (stderr)

kartomat.cpp: In function 'int main()':
kartomat.cpp:21:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |    if(str[i].length()>k&&pos)l[str[i][k]-'A']=true;
      |       ~~~~~~~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...