# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
891217 | vjudge1 | Combo (IOI18_combo) | C++17 | 12 ms | 1708 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;
using vi = vector<int>;
string guess_sequence(int N) {
char lit[] = {'A', 'B', 'X', 'Y'};
int prima = 0;
if(press("AB")) {
if(press("A")) prima = 0;
else prima = 1;
} else {
if(press("X")) prima = 2;
else prima = 3;
}
string cur;
cur += lit[prima];
vector<char> dif;
for(int j = 0; j < 4; ++j)
if(j != prima)
dif.push_back(lit[j]);
if(N == 1) return cur;
for(int i = 1; i + 1 < N; ++i) {
string s = cur + dif[0] + cur + dif[1] + dif[0] + cur + dif[1] + dif[1] + cur + dif[1] + dif[2];
//cout << "Dau query la " << s << " si obtin ";
int v = press(s);
// cout << v << "\n";
if(v == cur.size()) {
cur += dif[2];
} else if( v == cur.size() + 1 ) {
cur += dif[0];
} else
cur += dif[1];
// cout << cur << "\n";
}
if(press(cur + dif[0]) == N) {
cur += dif[0];
}
else if(press(cur + dif[1]) == N) {
cur += dif[1];
} else
cur += dif[2];
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |