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 <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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |