답안 #486118

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
486118 2021-11-10T14:53:56 Z groupATSU Karte (COCI15_karte) C++14
40 / 50
1 ms 292 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e9;
const int maxn=100;
const ll mod=1e9+7;
void solve(){
	string s;
	cin>>s;
	map <string,int> used;
	int cnt1=13,cnt2=13,cnt3=13,cnt4=13;
	for(int i=0;i<s.size()-2;i+=3){
		string helper="";
		helper+=s[i];
		helper+=s[i+1];
		helper+=s[i+2];
		if(used[helper]==1){
			cout<<"GRESKA";
			return ;
		}
		if(s[i]=='P')cnt1--;
		else if(s[i]=='K')cnt2--;
		else if(s[i]=='H')cnt3--;
		else cnt4--;
	}
	cout<<cnt1<<" "<<cnt2<<" "<<cnt3<<" "<<cnt4;
}
int main(){
	//ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int t=1;
   	//cin>>t;
    while(t--){
        solve();
        cout<<'\n';
    }


}

Compilation message

karte.cpp: In function 'void solve()':
karte.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int i=0;i<s.size()-2;i+=3){
      |              ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 292 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Incorrect 1 ms 204 KB Output isn't correct