# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896130 | wood | Combo (IOI18_combo) | C++17 | 13 ms | 1900 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
int press(string p);
string guess_sequence(int n){
string p = "";
char start;
if(press("AB")){
if(press("A"))
start = 'A';
else start = 'B';
}
else{
if(press("X"))
start = 'X';
else start = 'Y';
}
p+=start;
if(n>1){
vector<char> ch = {'A','B','X','Y'};
ch.erase(lower_bound(ch.begin(),ch.end(),start));
for (int i = 0; i < n-2; i++)
{
int guess = press(p+ch[0]+ch[0]+p+ch[0]+ch[1]+p+ch[0]+ch[2]+p+ch[1]);
if(guess==p.size()+2) p+=ch[0];
else if(guess==p.size()+1) p+=ch[1];
else p+=ch[2];
}
if(press(p+ch[0])==n) return p+ch[0];
else if(press(p+ch[1])==n) return p+ch[1];
else return p+ch[2];
}
else return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |