답안 #999193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999193 2024-06-15T08:02:22 Z AliHasanli Karte (COCI15_karte) C++17
50 / 50
1 ms 348 KB
#include <iostream>
using namespace std;
int i,n,ok,x,nr,d,y,j,k,v[1001];
short fr[200][30];
int sum[200];
string s;
int main(){
    cin>>s;
   for(i=0;s[i]!=0;i+=3){
    nr=(s[i+1]-48)*10+ s[i+2]-48;
    fr[s[i]][nr]++;
    if(fr[s[i]][nr]>1){
        cout<<"GRESKA";
        return 0;
    }
    sum[s[i]]++;
   }
   cout<<13-sum['P']<<" "<<13-sum['K']<<" "<<13-sum['H']<<" "<<13-sum['T'];
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:11:12: warning: array subscript has type 'char' [-Wchar-subscripts]
   11 |     fr[s[i]][nr]++;
      |            ^
karte.cpp:12:15: warning: array subscript has type 'char' [-Wchar-subscripts]
   12 |     if(fr[s[i]][nr]>1){
      |               ^
karte.cpp:16:13: warning: array subscript has type 'char' [-Wchar-subscripts]
   16 |     sum[s[i]]++;
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 348 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 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct