# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
516929 | AngusWong | Combo (IOI18_combo) | C++17 | 1 ms | 288 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 s="ABXY", ans="";
for (int i=0; i<=2; i++){
if (press(s.substr(i, 1))){
ans=s.substr(i, 1);
s.erase(s.begin()+i);
break;
}
}
if (ans==""){
ans="Y";
s.erase(s.begin()+3);
}
for (int i=2; i<n; i++){
int t=press(ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]);
if (t==i+1) ans+=s[0];
else if (t==i) ans+=s[1];
else ans+=s[2];
}
for (int i=0; i<=2; i++){
if (press(ans+s[i])==n){
ans+=s[i];
break;
}
}
if (ans.length()!=n) ans+="Y";
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |