Submission #959137

#TimeUsernameProblemLanguageResultExecution timeMemory
959137lalig777Marko (COCI15_marko)C++14
50 / 50
37 ms1116 KiB
#include <iostream> #include <vector> #include <unordered_map> using namespace std; int main(){ unordered_map<char, char>mapa; mapa['a']='2'; mapa['b']='2'; mapa['c']='2'; mapa['d']='3'; mapa['e']='3'; mapa['f']='3'; mapa['g']='4'; mapa['h']='4'; mapa['i']='4'; mapa['j']='5'; mapa['k']='5'; mapa['l']='5'; mapa['m']='6'; mapa['n']='6'; mapa['o']='6'; mapa['p']='7'; mapa['q']='7'; mapa['r']='7'; mapa['s']='7'; mapa['t']='8'; mapa['u']='8'; mapa['v']='8'; mapa['w']='9'; mapa['x']='9'; mapa['y']='9'; mapa['z']='9'; int n; cin>>n; vector<string>v(n); vector<bool>val(n, true); for (int i=0; i<n; i++) cin>>v[i]; string cod; cin>>cod; int ans=n; for (int i=0; i<cod.size(); i++){ char c=cod[i]; for (int j=0; j<n; j++){ string s=v[j]; if (val[j]==false) continue; if (s.size()<=i){ ans--; val[j]=false; } else if (mapa[s[i]]!=c){ ans--; val[j]=false; } } }int i=cod.size(); for (int j=0; j<n; j++){ string s=v[j]; if (val[j]==false) continue; if (s.size()>i) ans--; }cout<<ans<<endl; return 0; }

Compilation message (stderr)

marko.cpp: In function 'int main()':
marko.cpp:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for (int i=0; i<cod.size(); i++){
      |                   ~^~~~~~~~~~~
marko.cpp:24:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |             if (s.size()<=i){
      |                 ~~~~~~~~^~~
marko.cpp:37:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |         if (s.size()>i) ans--;
      |             ~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...