답안 #147525

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147525 2019-08-30T00:47:32 Z imsifile 백점을 받아랏! (FXCUP4_hundred) C++17
100 / 100
8 ms 384 KB
#include "hundred.h"
#include <algorithm>
using namespace std;
 
string bas, tmp; int mms[111], cc[3], fi;
 
string GetHundredPoints(int A, int B, int C) {
	for(int i=0; i<A; i++) bas += 'A';
	for(int i=0; i<B; i++) bas += 'B';
	for(int i=0; i<C; i++) bas += 'C';
	int bsc = Mark(bas);
	if(bsc == 100) return bas;
 
	for(int i=0; i<100; i++){
		if(bas[0]==bas[i]) continue;
		tmp=bas; swap(tmp[0], tmp[i]);
		int cha = Mark(tmp)-bsc;
		if(!cha) mms[i]=0;
		else if((cha+3)%3==1) mms[i]=(bas[i]-bas[0]+3)%3;
		else mms[i]=(bas[0]-bas[i]+3)%3;
	}
	for(int i=1; i<100; i++){
		if(bas[0]!=bas[i]) break;
		tmp=bas; swap(tmp[i], tmp[99]);
		int cha = Mark(tmp)-bsc;
		if(!cha) mms[i]=mms[99];
		else if((cha+3)%3==1) mms[i]=(mms[99]+bas[i]-bas[99]+3)%3;
		else mms[i]=(mms[99]+bas[99]-bas[i]+3)%3;
	}
	for(int i=0; i<100; i++) cc[mms[i]]++;
	if(cc[0]==A && cc[1]==B) fi=0;
	else if(cc[0]==B && cc[1]==C) fi=1;
	else fi=2;
 
	bas="";
	for(int i=0; i<100; i++) bas+="ABC"[(fi+mms[i])%3];
	return bas;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 8 ms 256 KB Output is correct
7 Correct 7 ms 304 KB Output is correct
8 Correct 7 ms 256 KB Output is correct
9 Correct 7 ms 256 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 7 ms 384 KB Output is correct
14 Correct 6 ms 256 KB Output is correct
15 Correct 6 ms 256 KB Output is correct
16 Correct 6 ms 256 KB Output is correct