| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 524497 | TITANOBOXER | Combo (IOI18_combo) | C++17 | 1 ms | 200 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 "combo.h"
#include<string>
#include<vector>
#include<iostream>
using namespace std;
std::string guess_sequence(int N) {
int cost = press("AB");
string cur;
if(cost) {
if(press("A")) {
cur = "A";
} else {
cur = "B";
}
} else {
if(press("X")) {
cur = "X";
} else {
cur = "Y";
}
}
char ost = cur[0];
char a,b,c;
if(ost == 'A') a = 'B',b = 'X',c = 'Y';
if(ost == 'B') a = 'A',b = 'X',c = 'Y';
if(ost == 'X') a = 'A',b = 'B',c = 'Y';
if(ost == 'Y') a = 'A',b = 'B',c = 'X';
int prv = 1;
for(int i = 1; i < N - 1; ++i) {
string s;
s += cur + a;
s += cur + b + a;
s += cur + b + b;
s += cur + b + c;
int cost = press(s);
if(cost == prv) {
cur += c;
prv += 1;
}
if(cost == prv + 1) {
cur += a;
prv += 1;
}
if(cost == prv + 2) {
cur += b;
prv += 1;
}
}
if(cur.size() < N) {
if(press(cur + a + cur + b) == N) {
if(press(cur + a) == N) {
cur += a;
} else {
cur += b;
}
} else {
cur += c;
}
}
cout << cur << endl;
return cur;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
