# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299649 | TMJN | Combo (IOI18_combo) | C++17 | 41 ms | 668 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;
const string C[4]={"A","B","X","Y"};
string guess_sequence(int N) {
string S;
int t=3;
for(int i=0;i<3;i++){
if(press(C[i]))t=i;
}
S+=C[t];
if(N==1)return S;
for(int i=1;i<N-1;i++){
string T;
T+=S+C[(t+1)%4]+C[(t+1)%4]+S+C[(t+1)%4]+C[(t+2)%4]+S+C[(t+1)%4]+C[(t+3)%4]+S+C[(t+2)%4];
int k=press(T);
if(k==S.size()){
S+=C[(t+3)%4];
}
else if(k==S.size()+1){
S+=C[(t+2)%4];
}
else{
S+=C[(t+1)%4];
}
}
for(int i=1;i<=2;i++){
string T;
T+=S+C[(t+i)%4];
if(press(T)==N){
return T;
}
}
S+=C[(t+3)%4];
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |