# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
75440 | Vardanyan | Combo (IOI18_combo) | C++14 | 50 ms | 564 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string ans = "";
vector<string> v;
if(press("AB") >= 1){
if(press("A") == 1){ ans+="A";
v.push_back("B"); v.push_back("X"); v.push_back("Y");
}
else {
ans+="B";
v.push_back("A"); v.push_back("X"); v.push_back("Y");
}
}
else{ if(press("X") == 1){
ans+="X";
v.push_back("B"); v.push_back("A"); v.push_back("Y");
}
else {
ans+="Y";
v.push_back("B"); v.push_back("X"); v.push_back("A");
}
}
while(ans.length()+2<=N){
string p = ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2];
int k = press(p);
if(k-ans.length() == 1) ans+=v[0];
else if(k-ans.length() == 2) ans+=v[1];
else if(k-ans.length() == 0) ans+=v[2];
}
if(ans.length() == N) return ans;
if(press(ans+v[0]) == N) return ans+v[0];
if(press(ans+v[1]) == N) return ans+v[1];
return ans+v[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |