# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
982360 | batsukh2006 | Combo (IOI18_combo) | C++17 | 1 ms | 544 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 t="ABXY",ans="";
for(int i=0; i<3; i++){
string r="";
r+=t[i];
if(press(r)) ans+=t[i];
}
string s="";
if(ans.size()==0) ans+=t[3];
for(int i=0; i<4; i++){
string r="";
r+=t[i];
if(r!=ans) s+=t[i];
}
for(int i=1; i<N-1; i++){
string tmp="";
tmp+=ans+s[0];
tmp+=ans+s[1]+s[0];
tmp+=ans+s[1]+s[1];
tmp+=ans+s[1]+s[2];
int lst=ans.size();
int find=press(tmp);
if(find==lst) ans+=s[2];
else if(find==lst+1) ans+=s[0];
else ans+=s[1];
}
bool ok=0;
for(int i=0; i<2; i++){
string r=ans;
r+=s[i];
if(press(r)>ans.size()) ans+=s[i],ok=1;
}
if(!ok) ans+=s[2];
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |