# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95739 | SomeoneUnknown | Combo (IOI18_combo) | C++14 | 2 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 <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
if(N == 1){
if(press("AB") == 1){
if(press("A") == 1){
return "A";
}else{
return "B";
}
}else{
if(press("X") == 1){
return "X";
}else{
return "Y";
}
}
}
int r = press("ABXAXBA");
string combo = "";
if(r >= 2){
string ord = "ABX";
if(press("ABXA") == 1){
ord = "AXB";
}
string p = "A" + ord[1];
switch(press(p)){
case 2: combo = p; break;
case 1: combo += ord[1]; combo += ord[2]; break;
case 0: combo += ord[2]; combo += ord[0]; break;
}
}else if(r == 1){
if(press("BX") == 1){
if(press("B") == 1){
combo = "BY";
}else{
combo = "XY";
}
}else{
combo = "AY";
}
}else if(r == 0){
if(press("YBYX") == 2){
if(press("YB") == 2){
combo = "YB";
}else{
combo = "YX";
}
}else{
combo = "YA";
}
}
vector<char> nfirst;
string x = "ABXY";
for(int i = 0; i < 4; i++){
if(combo[0] != x[i]){
nfirst.push_back(x[i]);
}
}
if(N == 2){
return combo;
}
for(int i = 2; i < N-1; i++){
string ask = combo + x[1];
for(int i = 0; i < 3; i++){
ask += combo + x[2];
ask += x[i];
}
int l = combo.length();
combo += x[press(ask)-l];
}
if(combo.length() == press(combo + x[0])){
return combo + x[0];
}
if(combo.length() == press(combo + x[1])){
return combo + x[1];
}
return combo + x[2];
/*std::string p = "";
/*for (int i = 0; i < 4 * N; ++i) {
p += 'A';
}
int coins = press(p);
std::string S = "";
for (int i = 0; i < N; ++i) {
S += 'A';
}
return S;//*/
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |