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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
#define fi first
#define sc second
vector<string> p = {"A", "B", "X", "Y"};
string guess_sequence(int N){
string ans = "";
if(press("AB")){
if(press("A"))
ans = "A";
else ans = "B";
} else if(press("X")) ans = "X"; else ans = "Y";
for(string& t : p){
if(t == ans){
swap(t, p[3]);
p.pop_back();
break;
}
}
for(int i = 1; i < N; ++i){
string tmp = ans + p[0] + p[0] + ans + p[0] + p[1] + ans + p[0] + p[2] + ans + p[1];
if((int)tmp.size() > 4 * N){
if(press(ans + p[0]) == i + 1) ans += p[0];
else if(press(ans + p[1]) == i + 1) ans += p[1];
else ans += p[2];
continue;
}
int t = press(tmp);
if(t == i + 2){
ans.append(p[0]);
continue;
}
if(t == i + 1){
ans.append(p[1]);
continue;
}
ans.append(p[2]);
}
return ans;
}
Compilation message (stderr)
combo.cpp:1:19: warning: extra tokens at end of #include directive
1 | #include "combo.h";
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |