Submission #171779

#TimeUsernameProblemLanguageResultExecution timeMemory
171779ToniBKarte (COCI15_karte)C++14
15 / 50
2 ms504 KiB
#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;
    
    for(int i = 0; i < s.length(); ++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; 
    	if(s[i] == 'H') h[ind] += 1; 
    	if(s[i] == 'P') p[ind] += 1; 
    	if(s[i] == 'T') t[ind] += 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;
}

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:13:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < s.length(); ++i){
                    ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...