This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |