# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
434447 | chirathnirodha | Combo (IOI18_combo) | C++17 | 48 ms | 692 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;
#define MP make_pair
#define PB push_back
#define F first
#define S second
string guess_sequence(int N) {
int x;string check;
x=press("AB");
string ans;
if(x>0){
if(x==1){
x=press("A");
if(x==1)ans.PB('A');
else ans.PB('B');
}
else ans.PB('A');
}
else{
x=press("X");
if(x==1)ans.PB('X');
else ans.PB('Y');
}
if(ans.size()==N)return ans;
vector<char> rem;
rem.PB('A');rem.PB('B');rem.PB('X');rem.PB('Y');
for(int i=0;i<4;i++)if(rem[i]==ans[0]){rem.erase(rem.begin()+i);break;}
for(int i=1;i<N-1;i++){
check=(ans+rem[0]) + (ans+rem[1]+rem[0]) + (ans+rem[1]+rem[1]) + (ans+rem[1]+rem[2]);
x=press(check)-ans.size();
if(x==0)ans.PB(rem[2]);
else if(x==1)ans.PB(rem[0]);
else ans.PB(rem[1]);
}
check=ans+rem[0];x=press(check)-ans.size();
if(x==1)ans.PB(rem[0]);
else {
check=ans+rem[1];x=press(check)-ans.size();
if(x==1)ans.PB(rem[1]);
else ans.PB(rem[2]);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |