답안 #171780

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171780 2019-12-30T11:51:05 Z ToniB Karte (COCI15_karte) C++14
50 / 50
2 ms 376 KB
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
    string s;
    cin >> s;
    
    int h[13] = {0}, k[13] = {0}, t[13] = {0}, p[13] = {0}, ukh = 0, ukt = 0, ukp = 0, ukk = 0;
    int len = s.length();
    
    for(int i = 0; i < len; ++i){
    	int des = s[i + 1];
    	int jed = s[i + 2];
    	
    	des -= 48;
    	jed -= 48;
    	
    	int ind = des * 10 + jed;
    	
    	if(s[i] == 'K') k[ind - 1] += 1; 
    	if(s[i] == 'H') h[ind - 1] += 1; 
    	if(s[i] == 'P') p[ind - 1] += 1; 
    	if(s[i] == 'T') t[ind - 1] += 1;
    	
    	i += 2;
	}
	
	for(int i = 0; i < 13; ++i){
		ukh += h[i]; ukp +=  p[i]; ukk += k[i]; ukt += t[i];
		
		if(h[i] > 1 or p[i] > 1 or t[i] > 1 or k[i] > 1){
			cout << "GRESKA";
			return 0;
		}
		
	}
	
	cout << 13 - ukp << " " << 13 - ukk << " " << 13 - ukh << " " << 13 - ukt;
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct