Submission #900154

# Submission time Handle Problem Language Result Execution time Memory
900154 2024-01-07T18:37:53 Z joccccca Karte (COCI15_karte) C++14
50 / 50
0 ms 440 KB
#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

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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 440 KB Output is correct