# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
630467 | NintsiChkhaidze | Combo (IOI18_combo) | C++14 | 43 ms | 544 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>
#define pb push_back
using namespace std;
vector <char> v = {'A', 'B', 'X', 'Y'}, w;
string guess_sequence(int N) {
string S = "";
for (char c: v){
string P = S + c;
if (press(P) == 1) {
S = P;
break;
}
}
char f = S[0];
for (auto c: v)
if (c!=f) w.pb(c);
while (S.size() < N - 1){
string p = S + w[0] + S + w[1] + w[0] + S + w[1] + w[1] + S + w[1] + w[2];
int coins = press(p),s = S.size();
if (coins == s) S += w[2];
else if (coins == s + 1) S += w[0];
else if (coins == s + 2) S += w[1];
}
for (char c: w){
string P = S + c;
if (press(P) == S.size() + 1) {
S = P;
break;
}
}
return S;
}
// ABXYBXXXXBY
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |