답안 #147705

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147705 2019-08-30T12:50:08 Z gina(#3662, imyujin) 백점을 받아랏! (FXCUP4_hundred) C++17
33 / 100
8 ms 384 KB
#include "hundred.h"
#include <bits/stdc++.h>
using namespace std;

string solve(int An, int Bn, char A, char B) {
	string ans;
	for(int i = 0; i < 100; i++) ans.push_back(B);
	if(An == 0) return ans;

	int res[100];
	string s;
	for(int i = 0; i < An - 1; i++) s.push_back(A);
	for(int i = An - 1; i < 100; i++) s.push_back(B);
	for(int i = 50; i < 100; i++) {
		s[i] = A;
		res[i] = Mark(s);
		s[i] = B;
	}
	int mn = 100;
	for(int i = 50; i < 100; i++) mn = min(mn, res[i]);
	for(int i = 50; i < 100; i++) if(res[i] > mn) ans[i] = A;

	for(int i = 0; i < Bn + 1; i++) s[i] = B;
	for(int i = Bn + 1; i < 100; i++) s[i] = A;
	for(int i = 0; i < 50; i++) {
		s[i] = A;
		res[i] = Mark(s);
		s[i] = B;
	}
	mn = 100;
	for(int i = 0; i < 50; i++) mn = min(mn, res[i]);
	for(int i = 0; i < 50; i++) if(res[i] > mn) ans[i] = A;
	return ans;
}

string GetHundredPoints(int A, int B, int C) {
	return A < B ? solve(A, B, 'A', 'B') : solve(B, A, 'B', 'A');
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Incorrect 5 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -