Submission #104655

#TimeUsernameProblemLanguageResultExecution timeMemory
104655MatesV13Karte (COCI15_karte)C++11
50 / 50
3 ms384 KiB
#include <bits/stdc++.h> using namespace std; string s; char a, b, c; int d; set<int> n[100]; int main (){ ios::sync_with_stdio(0); cin.tie(0); cin >> s; for (int i=0;i<s.size();i+=3){ a=s[i]; b=s[i+1]; c=s[i+2]; d=0; if (b=='1') d=10; for (char i = '0';i<='9';i++) if (c==i) d += (int)i - (int)'0'; n[a].insert(d); } if (n['P'].size() + n['K'].size() + n['H'].size() + n['T'].size() != (s.size()/3)) cout << "GRESKA"; else cout << 13 - n['P'].size() << " " << 13 - n['K'].size() << " " << 13 - n['H'].size() << " " << 13 - n['T'].size(); return 0; }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:10:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0;i<s.size();i+=3){
               ~^~~~~~~~~
karte.cpp:17:6: warning: array subscript has type 'char' [-Wchar-subscripts]
   n[a].insert(d);
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...