# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
196890 | Juney | Combo (IOI18_combo) | C++14 | 47 ms | 612 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;
char find_first() {
int ret = press("AB");
if(ret == 0) {
if(press("X") == 1) return 'X';
return 'Y';
}
if(press("A") == 1) return 'A';
return 'B';
}
string guess_sequence(int N) {
string ans;
char A = 'A', B = 'B', X = 'X', Y = 'Y';
char f = find_first();
if(f == B) swap(A, B);
else if(f == X) swap(A, X);
else if(f == Y) swap(A, Y);
ans += f;
if(N == 1) return ans;
for(int i=1; i<N-1; i++) {
string tmp = ans + X + ans + Y + B + ans + Y + X + ans + Y + Y;
int cnt = press(tmp);
if(cnt == ans.size()) ans += B;
else if(cnt == ans.size() + 1) ans += X;
else ans += Y;
}
int cnt = press(ans + X + ans + Y);
if(cnt == N) {
if(press(ans + X) == N) return ans + X;
return ans + Y;
}
return ans + B;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |