Submission #900154

#TimeUsernameProblemLanguageResultExecution timeMemory
900154jocccccaKarte (COCI15_karte)C++14
50 / 50
0 ms440 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int br[4][14]; signed main() { string s; cin>>s; if(s.size()>3*54+1)cout<<"GRESKA"; else{ string a = ""; int b = 0; for(int i=0; i < s.size()-2; i++){ if(s[i]=='P'){ a=s.substr(i+1,2); b=stoi(a); br[0][b]++; } if(s[i]=='K'){ a=s.substr(i+1,2); b=stoi(a); br[1][b]++; } if(s[i]=='H'){ a=s.substr(i+1,2); b=stoi(a); br[2][b]++; } if(s[i]=='T'){ a=s.substr(i+1,2); b=stoi(a); br[3][b]++; } } bool rez=true; for(int i=0; i < 4; i++){ for(int j=0; j < 14; j++){ if(br[i][j]>1){ rez=false; break; } } } int rez1=13; int rez2=13; int rez3=13; int rez4=13; for(int j=0; j < 14; j++)if(br[0][j]==1)rez1--; for(int j=0; j < 14; j++)if(br[1][j]==1)rez2--; for(int j=0; j < 14; j++)if(br[2][j]==1)rez3--; for(int j=0; j < 14; j++)if(br[3][j]==1)rez4--; if(rez){ cout<<rez1<<" "<<rez2<<" "<<rez3<<" "<<rez4; }else{ cout<<"GRESKA"; } } }

Compilation message (stderr)

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