# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
731328 | peteza | Combo (IOI18_combo) | C++14 | 38 ms | 648 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>
using namespace std;
int press(string p);
string str, toq;
char chrs[5] = "ABXY";
string guess_sequence(int N) {
if(press("AB")) {
if(press("A")) str = 'A';
else str = 'B';
} else {
if(press("X")) str = 'X';
else str = 'Y';
}
if(N == 1) return str;
for(int i=0;i<=2;i++) if(str[0] == chrs[i]) swap(chrs[i], chrs[i+1]);
for(int i=0;i<N-2;i++) {
toq = str + chrs[0] + chrs[0] + str + chrs[0] + chrs[1] + str + chrs[0] + chrs[2] + str + chrs[1];
int req = press(toq);
if(req == str.size()) str += chrs[2];
else if(req == str.size() + 1) str += chrs[1];
else str += chrs[0];
}
for(int i=0;i<2;i++) {
if(press(str + chrs[i]) == N) return str + chrs[i];
}
return str + chrs[2];
}
/*
int press(string p) {
cout << p;
int x; cin >> x; return x;
}
int main() {cout << guess_sequence(5);}
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |