# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95574 | dantoh000 | Combo (IOI18_combo) | C++14 | 53 ms | 712 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;
#include "combo.h"
string guess_sequence(int N) {
char firstletter;
string S = "";
string p = "";
char choices[3];
if (press("AB") >= 1){
if (press("A") == 1){
firstletter = 'A';
}
else firstletter = 'B';
}
else {
if (press("X") == 1){
firstletter = 'X';
}
else firstletter = 'Y';
}
int cur = 0;
if (firstletter != 'A') choices[cur++] = 'A';
if (firstletter != 'B') choices[cur++] = 'B';
if (firstletter != 'X') choices[cur++] = 'X';
if (firstletter != 'Y') choices[cur++] = 'Y';
S += firstletter;
int curscore = 1;
for (int i = 1; i < N-1; ++i) {
p = S+choices[0] + choices[0] + S+choices[0]+choices[1]+S+choices[0]+choices[2]+S+choices[1];
//cout << "guessing " << p << " size of " << N << " " << p.length() << endl;
int score = press(p);
if (score == curscore){
S += choices[2];
}
else if (score == curscore+1){
S += choices[1];
}
else {
S += choices[0];
}
curscore++;
}
if (S.size() == N-1){
p = S+choices[0] + S+choices[1];
if (press(p) == N){
p = S+choices[0];
if (press(p) == N){
S += choices[0];
}
else S += choices[1];
}
else S += choices[2];
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |