# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776278 | Lobo | Combo (IOI18_combo) | C++17 | 28 ms | 592 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;
string guess_sequence(int N) {
string ans;
string a = "ABXY";
// for(int i = 0; i < 4; i++) {
// if(i == 3) {
// ans = a[i];
// a.erase(a.begin()+i,a.begin()+i+1);
// break;
// }
// string ask;
// ask+= a[i];
// if(press(ask)) {
// ans = a[i];
// a.erase(a.begin()+i,a.begin()+i+1);
// break;
// }
// }
if(press(ans+a[0]+a[1]) > 0) {
if(press(ans+a[0])) {
ans = a[0];
a = "BXY";
}
else {
ans = a[1];
a = "AXY";
}
}
else {
if(press(ans+a[2])) {
ans = a[2];
a = "ABY";
}
else {
ans = a[3];
a = "ABX";
}
}
if(N == 1) return ans;
for(int i = 1; i < N-1; i++) {
string ask;
ask = ans + a[0] + a[0];
ask+= ans + a[0] + a[1];
ask+= ans + a[0] + a[2];
ask+= ans + a[1];
int c = press(ask);
if(c == ans.size()) ans+= a[2];
else if(c == ans.size()+1) ans+= a[1];
else if(c == ans.size()+2) ans+= a[0];
else assert(false);
}
if(press(ans+a[0]) == N) return ans+a[0];
else if(press(ans+a[1]) == N) return ans+a[1];
else return ans+a[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |