# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574996 | Hackapie | Combo (IOI18_combo) | C++17 | 36 ms | 648 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;
std::string guess_sequence(int N){
set<char> s;
s.insert('A');
s.insert('B');
s.insert('X');
s.insert('Y');
string res;
string check;
if(N==1){
if(press("A"))return "A";
else if(press("B")) return "B";
else if(press("X")) return "X";
else return "Y";
}
int ans=press("AB");
if(ans){
if(press("A"))res+='A';
else res+='B';
}else{
if(press("X"))res+='X';
else res+='Y';
}
s.erase(res[0]);
for(auto x:s)check+=x;
while(res.size()<N-1){
string ch=res+check[1]+res+check[2]+check[0]+res+check[2]+check[1]+res+check[2]+check[2];
res+=check[press(ch)-res.size()];
}
if(press(res+check[0])==N){
res+=check[0];
}else if(press(res+check[1])==N){
res+=check[1];
}else res+=check[2];
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |