# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
535420 | mario05092929 | Combo (IOI18_combo) | C++14 | 74 ms | 592 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 x first
#define y second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll,ll> pl;
typedef pair <int,int> pi;
typedef vector <int> vec;
const ll INF = 1e18;
char pr[4];
string ans;
int n,g;
string guess_sequence(int N) {
n = N;
string p;
p = "AB";
int cmp = press(p);
if(cmp) {
p = "A";
cmp = press(p);
if(cmp) pr[3] = 'A';
else pr[3] = 'B';
}
else {
p = "X";
cmp = press(p);
if(cmp) pr[3] = 'X';
else pr[3] = 'Y';
}
ans += pr[3];
if(n == 1) return ans;
if(pr[3] != 'A') pr[g++] = 'A';
if(pr[3] != 'B') pr[g++] = 'B';
if(pr[3] != 'X') pr[g++] = 'X';
if(pr[3] != 'Y') pr[g++] = 'Y';
int i = 1;
for(;i < n-1;i++) {
p.clear();
for(int j = 0;j < 3;j++) {
for(int k = 0;k < i;k++) p += ans[k];
p += pr[0];
p += pr[j];
}
for(int k = 0;k < i;k++) p += ans[k];
p += pr[1];
cmp = press(p);
if(cmp == i) ans += pr[2];
else if(cmp == i+1) ans += pr[1];
else ans += pr[0];
}
p.clear();
for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[0];
for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[1];
cmp = press(p);
if(cmp == n) {
p.clear();
for(int j = 0;j < n-1;j++) p += ans[j];
p += pr[0];
cmp = press(p);
if(cmp == n) ans += pr[0];
else ans += pr[1];
}
else ans += pr[2];
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |