# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
530346 | DJ035 | Combo (IOI18_combo) | C++17 | 36 ms | 652 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 <vector>
using namespace std;
std::string guess_sequence(int N) {
string S,st="ABXY";
int n=N;
int p=press("AB");
char f;
if(!p){
p=press("X");
if(p) S += 'X';
else S += 'Y';
}
else {
p=press("A");
if(p) S += 'A';
else S += 'B';
}
f = S[0];
vector<char> h;
for(int i=0; i<4; i++)
if(st[i]!=f)
h.push_back(st[i]);
for(int i=1; i<n-1; i++){
string in;
in += S;
in += h[1];
for(int j=0; j<3; j++){
in += S;
in += h[0];
in += h[j];
}
p=press(in);
//cout << S.size() << ' ' << p << '\n';
if(p==S.size()+2) S += h[0];
else if(p==S.size()+1) S += h[1];
else S += h[2];
}
if(n==1) return S;
for(int i=0; i<2; i++){
p=press(S+h[i]);
if(p==n)
return S+h[i];
}
return S+h[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |