# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961163 | marinaluca | Combo (IOI18_combo) | C++17 | 0 ms | 0 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>
/**#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")
**/
using namespace std;
#define int long long
#define ll long long
#define all(x) begin(x), end(x)
#define XX first
#define YY second
/**
#define cin fin
#define cout fout
ifstream cin ("");
ofstream cout ("");
**/
deque <char> buton = {'A', 'B', 'X', 'Y'};
int press (string s);
int N;
string guess_sequence (int N){
string v;
if (press("AB") > 0){
if (press("A") > 0){
v = "A";
buton.erase(buton.begin());
}
else{
v = "B";
buton.erase(buton.begin() + 1);
}
}
else{
if (press("X") > 0){
v = "X";
buton.erase(buton.begin() + 2);
}
else{
v = "Y";
buton.erase(buton.begin() + 3);
}
}
if (N == 1){
return v;
}
for (int i = 2; i <= N - 1; ++ i){
int sum = press (v + buton[1] + v + buton[2] + buton[0] + v + buton[2] + buton[1] + v + buton[2] + buton[2]);
v += buton[sum - v.size()];
}
if (press (v + buton[0] + v + buton[1]) > v.size()){
if (press (v + buton[0]) > v.size()){
v += buton[0];
}
else{
v += buton[1];
}
}
else{
v += buton[2];
}
return v;
}
/**signed main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
return 0 ^ 0;
}**/