Submission #147705

# Submission time Handle Problem Language Result Execution time Memory
147705 2019-08-30T12:50:08 Z gina(#3662, imyujin) Get Hundred Points! (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');
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 -