답안 #167368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167368 2019-12-07T18:00:44 Z 44442 Karte (COCI15_karte) C++11
50 / 50
2 ms 380 KB
#include <bits/stdc++.h>
using namespace std;
string s;
int a,x;
bool ok;
multiset<int>m[6];
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>s;
m[1].insert(14);
m[2].insert(14);
m[3].insert(14);
m[4].insert(14);
multiset<int>::iterator it;
for(int i=0;i<s.size();i=i+3){
	 if(s[i]=='P'){
	 	 x=1;
	 }
	 else if(s[i]=='K'){
	 	 x=2;
	 }
	 else if(s[i]=='H'){
	 	 x=3;
	 }
	 else{
	 	 x=4;
	 }
	 	 a=10*((int)s[i+1]-48)+(int)s[i+2]-48;
	 	 it=m[x].lower_bound(a);
	 	 if(*it==a){
	 	 	 ok=1;
	 	 	 break;
		 }
	 	 m[x].insert(a);
}
 if(ok){
 	 cout<<"GRESKA";
 }
 else{
 	 for(int i=1;i<5;i++){
 	 	 cout<<13-m[i].size()+1<<" ";
	  }
 }
return 0;
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:16:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int i=0;i<s.size();i=i+3){
             ~^~~~~~~~~
# 결과 실행 시간 메모리 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 380 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 380 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct