# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
721811 | minhcool | Combo (IOI18_combo) | C++17 | 34 ms | 472 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 int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
int n;
string ans;
string cand;
string guess_sequence(int N){
n = N;
int ind = 3;
if(press("AB")){
if(press("A")){
ind = 0;
ans += "A";
cand = "BXY";
}
else{
ind = 1;
ans += "B";
cand = "AXY";
}
}
else{
if(press("X")){
ind = 2;
ans += "X";
cand = "ABY";
}
else{
ind = 3;
ans += "Y";
cand = "ABX";
}
}
for(int i = 1; ;){
//cout << i << " " << ans << "\n";
if(i >= (n - 1)) break;
string temp;
temp += ans;
temp += cand[0];
temp += cand[0];
temp += ans;
temp += cand[0];
temp += cand[1];
temp += ans;
temp += cand[1];
temp += cand[1];
int val = press(temp);
if(val == i){
ans += cand[2];
i++;
}
else if(val == (i + 1)){
temp.clear();
temp += ans + cand[1] + cand[2];
val = press(temp);
if(val == i){
ans += cand[0];
ans += cand[2];
}
else if(val == i + 1){
ans += cand[1];
ans += cand[0];
}
else{
ans += cand[1];
ans += cand[2];
}
i += 2;
}
else{
temp.clear();
temp += ans + cand[0] + cand[1];
val = press(temp);
if(val == i){
ans += cand[1];
ans += cand[1];
}
else if(val == i + 1){
ans += cand[0];
ans += cand[0];
}
else{
ans += cand[0];
ans += cand[1];
}
i += 2;
}
}
if(ans.length() < n){
string temp = ans + cand[0];
if(press(temp) == n) ans += cand[0];
else{
temp = ans + cand[1];
if(press(temp) == n) ans += cand[1];
else ans += cand[2];
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |