Submission #148276

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1482762019-08-31 19:39:50ksun48 (#201)Get Hundred Points! (FXCUP4_hundred)C++17
100 / 100
8 ms384 KiB
#include "hundred.h"
#include <bits/stdc++.h>
std::string GetHundredPoints(int A, int B, int C) {
using namespace std;
assert(A + B + C == 100);
string str;
for(int i = 0; i < A; i++) str += 'A';
for(int i = 0; i < B; i++) str += 'B';
for(int i = 0; i < C; i++) str += 'C';
if(A == 100) return string(100, 'A');
if(B == 100) return string(100, 'B');
if(C == 100) return string(100, 'C');
string ans(A + B + C, 'A');
int value = Mark(str);
auto f = [&](int a, int b){
string new_str = str;
swap(new_str[a], new_str[b]);
int diff = (Mark(new_str) - value) * (str[b] - str[a]) % 3;
if(diff < 0) diff += 3;
ans[b] = ((ans[a] - 'A' + diff) % 3) + 'A';
};
if(A && B && C){
for(int i = A; i < A+B; i++) f(0, i);
for(int i = 1; i < A; i++) f(A, i);
for(int i = A+B; i < A+B+C; i++) f(A, i);
} else {
int a = A ? A : B;
int b = C ? C : B;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...