# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1111888 | nikolashami | Combo (IOI18_combo) | C++17 | 50 ms | 2056 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<bits/stdc++.h>
using namespace std;
#include "combo.h"
string qs;
int q;
string guess_sequence(int N){
int n=N;
char prvi;
qs="ABAB";
q=press(qs);
if(!q){
qs="X";
if(press(qs))
prvi='X';
else
prvi='Y';
}else{
qs="A";
if(press(qs))
prvi='A';
else
prvi='B';
}
qs.clear();
qs.push_back(prvi);
vector<char>v={'A','B','X','Y'};
v.erase(find(v.begin(),v.end(),prvi));
if(n==1)
return qs;
while(qs.size()<n-1){
string cur=qs;
cur+=v[0];
cur+=v[1];
cur+=qs;
cur+=v[0];
cur+=v[2];
cur+=qs;
cur+=v[0];
cur+=v[0];
cur+=qs;
cur+=v[1];
q=press(cur)-qs.size();
if(!q)
qs.push_back(v[2]);
else if(q==1)
qs.push_back(v[1]);
else
qs.push_back(v[0]);
}
string tmp=qs;
tmp+=v[0];
tmp+=qs;
tmp+=v[1];
q=press(tmp)-qs.size();
if(q){
tmp.clear();
tmp+=qs;
tmp+=v[0];
if(press(tmp)-qs.size())
qs.push_back(v[0]);
else
qs.push_back(v[1]);
}else
qs.push_back(v[2]);
return qs;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |