답안 #1005458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005458 2024-06-22T13:11:06 Z vjudge1 Karte (COCI15_karte) C++17
50 / 50
0 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
    string s; cin>>s;
    set<int> p,k,h,t; 
    for (int i=1; i<=13; i++){
        p.insert(i), k.insert(i), h.insert(i), t.insert(i);
    }
    bool ok=true;
    for (int i=0; i<s.length(); i+=3){
        int suit=s[i];
        int number=(s[i+1]-'0')*10+(s[i+2]-'0');
        if (suit=='P'){
            if (p.count(number)==0) ok=false;
            else p.erase(number);
        } else if (suit=='K') {
            if (k.count(number)==0) ok=false;
            else k.erase(number);            
        } else if (suit=='H'){
            if (h.count(number)==0) ok=false;
            else h.erase(number);
        } else if (suit=='T'){
            if (t.count(number)==0) ok=false;
            else t.erase(number);
        }
    }
    if (ok){
        cout<<(int)(p.size())<<' '<<(int)(k.size())<<' '<<(int)(h.size())<<' '<<(int)(t.size())<<'\n';
    } else{
        cout<<"GRESKA"<<'\n';
    }
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:13:20: 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]
   13 |     for (int i=0; i<s.length(); i+=3){
      |                   ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 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 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct