# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
477455 | SlavicG | Combo (IOI18_combo) | C++17 | 34 ms | 660 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;
#define ll long long
#define forn(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define sz(a) (int)a.size()
string guess_sequence(int n){
string cur = "";
vector<char> c;
c.pb('X');
c.pb('Y');
c.pb('A');
c.pb('B');
char first = 'f';
if(press("XY")){
if(press("X"))first = 'X';
else first = 'Y';
}else{
if(press("A"))first = 'A';
else first = 'B';
}
c.erase(find(all(c), first));
assert(sz(c) == 3);
cur += first;
for(int i = 1;i < n - 1;++i){
string qr = cur;
qr += c[0];
qr += c[0];
qr += cur;
qr += c[0];
qr += c[1];
qr += cur;
qr += c[0];
qr += c[2];
qr += cur;
qr += c[1];
int x = press(qr);
if(x == 2 + cur.size()){
cur += c[0];
}else if(x == 1 + cur.size()){
cur += c[1];
}else{
cur += c[2];
}
}
if(sz(cur) < n){
if(press(cur + c[0]) == n)cur += c[0];
else if(press(cur + c[1]) == n)cur += c[1];
else cur += c[2];
}
assert(sz(cur) == n);
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |