# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1032463 | ThommyDB | Combo (IOI18_combo) | C++17 | 1 ms | 344 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 p = "";
if(press("AB")>=1){
if(press("A") >= 1) p+="A";
else p+="B";
}
else{
if(press("X") >= 1) p+="X";
else p+="Y";
}
if(N==1)return p;
vector<char> a;
for(auto u : "ABXY"){
if(u!=p[0]) a.push_back(u);
}
for(int i = 1; i<N-1; i++){
string s = "";
s+=p;s+=p;s+=p;s+=p;s.push_back(a[0]);s.push_back(a[0]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[2]);
int v = press(s);
if(v == p.length() +1) p+=a[0];
else if(v==p.length()+2) p+=a[1];
else p+=a[2];
}
p.push_back(a[0]);
if(press(p) != N) {p.pop_back(); p.push_back(a[1]);}
else if(press(p)!=N) p.pop_back();
else p+=a[2];
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |