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;
if(press("AB")) {
if(press("A"))
ans += 'A';
else
ans += 'B';
} else if(press("X")) {
ans += 'X';
} else {
ans += 'Y';
}
if(n <= 1)
return ans;
vector<char> kar;
if(ans != "A")kar.push_back('A');
if(ans != "B")kar.push_back('B');
if(ans != "X")kar.push_back('X');
if(ans != "Y")kar.push_back('Y');
for(int i = 1; i < n-1; ++i) {
string s = ans + kar[0] + ans + kar[1] + kar[0] + ans + kar[1] + kar[1] + ans + kar[1] + kar[2];
int x = press(s);
if(x == i) {
ans += kar[2];
} else if(x == i+1) {
ans += kar[0];
} else {
ans += kar[1];
}
}
if(press(ans+kar[0]) == n) {
ans += kar[0];
} else if(press(ans+kar[1]) == n) {
ans += kar[1];
} else {
ans += kar[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |