# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110058 | DystoriaX | Combo (IOI18_combo) | C++14 | 51 ms | 596 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;
coins = press("AB");
if(coins == 0){
coins = press("X");
if(coins == 1) k = 'X';
else k = 'Y';
} else {
coins = press("A");
if(coins == 1) k = 'A';
else k = 'B';
}
p += k;
if(N == 1) return p;
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... |