# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1061625 | Petrix | Combo (IOI18_combo) | C++17 | 23 ms | 1744 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<string>
#include<vector>
using namespace std;
string guess_sequence(int n){
vector<char> v;
int i,aux1;
string s,aux;
if(press("AB")){
if(press("A")) s='A';
else s='B';
}else{
if(press("X")) s='X';
else s='Y';
}
if(n==1) return s;
if(s[0]!='X') v.push_back('X');
if(s[0]!='Y') v.push_back('Y');
if(s[0]!='A') v.push_back('A');
if(s[0]!='B') v.push_back('B');
for(i=2;i<=n-1;i++){
aux=s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2];
aux1=press(aux);
if(aux1==i-1) s+=v[2];
else if(aux1==i) s+=v[0];
else s+=v[1];
}
if(press(s+v[0])==s.size()+1) s+=v[0];
else if(press(s+v[1])==s.size()+1) s+=v[1];
else s+=v[2];
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |