# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110057 | DystoriaX | Combo (IOI18_combo) | C++14 | 2 ms | 200 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 c[] = {'A', 'B', 'X', 'Y'};
char f[3];
char k;
string guess_sequence(int N) {
string p = "";
//Find first character
int coins = press("AB");
if(coins == 2) k = 'A';
else if (coins == 1) k = 'B';
else {
coins = press("XY");
if(coins == 2) k = 'X';
else k = 'Y';
}
p += k;
int x = 0;
for(int i = 0; i < 4; i++){
if(c[i] == k) continue;
f[x++] = c[i];
}
for(int i = 1; i < N - 1; i++){
string tp = "";
tp += p + f[0];
for(int j = 0; j < 3; j++) tp += p + f[1] + f[j];
coins = press(tp);
if(coins == i) p += f[2];
else if (coins == i + 1) p += f[0];
else p += f[1];
}
for(int i = 0; i < 2; i++){
coins = press(p + f[i]);
if(coins == N){
p += f[i];
break;
}
}
if(p.size() < N) p += f[2];
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |