# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147712 | pichulia,koosaga,ainta (#201) | Get Hundred Points! (FXCUP4_hundred) | C++17 | 7 ms | 256 KiB |
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"
static std::string flip(std::string a)
{
std::string b;
b.resize(100);
for (int i = 0; i < 99; i++)
{
b[i+1] = a[i];
}
b[0] = a[99];
return b;
}
std::string GetHundredPoints(int A, int B, int C) {
std::string res;
res.resize(100);
int i, j, k;
for (i = 0; i < A; i++)res[i] = 'A';
for (i = 0; i < B; i++)res[A + i] = 'B';
for (i = 0; i < C; i++)res[A + B + i] = 'C';
int score[100];
for (i = 0; i < 100; i++)
{
score[i] = Mark(res);
res = flip(res);
}
int valid[100][3];
for (i = 0; i < 100; i++) {
valid[i][0] = valid[i][1] = valid[i][2] = 0;
}
int dif;
int offset = 0;
for(offset=0; offset<100; offset++)
{
dif = (score[(offset + 1)%100] - score[offset]);
i = (offset + A) % 100;
j = (offset + A + B) % 100;
k = (offset + A + B + C) % 100;
for(int ti=0;ti<3;ti++)
for(int tj=0; tj<3; tj++)
for (int tk = 0; tk < 3; tk++)
{
{
int pi = (ti+1)%3;
int pj = (tj) % 3;
int pk = (tk + 2) % 3;
if (pi == 2)pi = -1; if (pj == 2)pj = -1; if (pk == 2)pk = -1;
if (pi + pj + pk == dif) {
valid[i][ti] |= 1;
valid[j][tj] |= 2;
valid[k][tk] |= 4;
}
}
}
}
for (i = 0; i < 100; i++)
{
int cnt = 0;
int ri = 0;
for (j = 0; j < 3; j++) {
if (valid[i][j] == 7)
{
cnt++;
ri = j;
}
}
res[i] = ri + 'A';
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |