# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143563 | mat_v | Combo (IOI18_combo) | C++14 | 54 ms | 680 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) {
string a = "AB";
string b = "B";
string x = "X";
string tren;
int prvi = press(a);
if(prvi){
a.clear();
a += 'A';
prvi = press(a);
if(prvi)tren = 'A';
else tren = 'B';
}
else{
prvi = press(x);
if(prvi)tren = 'X';
else tren = 'Y';
}
string d,t,c;
if(tren == "A"){
d = "X";
t = "Y";
c = "B";
}
else if(tren == "B"){
d = 'X';
t = 'Y';
c = 'A';
}
else if(tren == "X"){
d = 'A';
t = 'Y';
c = 'B';
}
else if(tren == "Y"){
d = 'X';
t = 'A';
c = 'B';
}
for(int i=1; i<N; i++){
if(i == N-1){
string frs = tren;
frs += d;
string frs2 = tren;
frs2 += t;
int sta = press(frs);
int sta2 = press(frs2);
if(sta > sta2)tren += d;
else if(sta2 > sta)tren += t;
else tren += c;
continue;
}
string frs = tren;
frs += d;
string sek1 = tren,sek2 = tren,sek3 = tren;
string pom1 = t;
pom1 += t;
string pom2 = t;
pom2 += d;
string pom3 = t;
pom3 += c;
sek1 += pom1;
sek2 += pom2;
sek3 += pom3;
frs += sek1;
frs += sek2;
frs += sek3;
int sta = press(frs);
if(sta == tren.size())tren += c;
else if(sta == tren.size() + 1)tren += d;
else tren += t;
}
//cout << tren << endl;
return tren;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |