# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007182 | christinelynn | 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>
#include "combo.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef unsigned long long int ull;
const ll md = 1e9+7;
const int ukr = 2e5+10;
int read() {
int ketek = 0; bool ne=0;
register char c = getchar();
while(c == ' ' or c =='\n') c =getchar();
if(c=='-'){ne = 1; c = getchar();}
while(c >= '0' and c <='9') { ketek = (ketek<<3)+(ketek<<1)+c-'0'; c = getchar();}
if(ne) ketek*=-1;
return ketek;
}
void print(int x) {
if (x < 0) {putchar('-');x = -x;}
int len = 0, buf[10];
if (x == 0) {putchar('0');return;}
while (x > 0) {buf[len++] = x % 10; x/=10;}
while (len > 0) {putchar('0' + buf[--len]);}
}
void File_Work(){
freopen("test.in","r",stdin);
freopen("test.out","w",stdout);
}
int n, m, a, b, c, d, id;
struct babi{
ll x, y, id;
};
struct babis{
ll x, y;
};
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a % b);
}
ll pgkt(ll rnx, ll rny){
if(rny == 0) return 1;
ll nwrn = pgkt(rnx, rny/2);
if(rny%2){
return (((nwrn*nwrn)%md)*rnx)%md;
}else{
return (nwrn*nwrn)%md;
}
}
vector<int> v;
string s;
string guess_sequence(int N) {
string ans = "";
int val = press("AB");
if(val >= 1){
if(val == 1){
ans += "A";
}else{
ans += "B";
}
}else{
val = press("X");
if(val >= 1){
ans += "X";
}else{
ans += "Y";
}
}
N--;
if(!N){
return ans;
}
if(ans == "A"){
int old = ans.length();
while(N-1){
val = press(ans+"BB"+ans+"BX"+ans+"BY"+ans+"X");
if((val-old) == 2){
ans += "B";
}else if((val-old)){
ans += "X";
}else{
ans += "Y";
}
old++;
N--;
}
val = press(ans+"B");
if(val == old+1){
ans += "B";
}else{
val = press(ans+"X");
if(val == old+1){
ans += "X";
}else{
ans += "Y";
}
}
}else if(ans == "B"){
int old = ans.length();
while(N-1){
val = press(ans+"AA"+ans+"AX"+ans+"AY"+ans+"X");
if((val-old) == 2){
ans += "A";
}else if((val-old)){
ans += "X";
}else{
ans += "Y";
}
old++;N--;
}
val = press(ans+"A");
if(val == old+1){
ans += "A";
}else{
val = press(ans+"X");
if(val == old+1){
ans += "X";
}else{
ans += "Y";
}
}
}else if(ans == "X"){
int old = ans.length();
while(N-1){
val = press(ans+"AA"+ans+"AB"+ans+"AY"+ans+"B");
if((val-old) == 2){
ans += "A";
}else if((val-old)){
ans += "B";
}else{
ans += "Y";
}
old++;N--;
}
val = press(ans+"B");
if(val == old+1){
ans += "B";
}else{
val = press(ans+"A");
if(val == old+1){
ans += "A";
}else{
ans += "Y";
}
}
}else{
int old = ans.length();
while(N-1){
val = press(ans+"AA"+ans+"AB"+ans+"AX"+ans+"B");
if((val-old) == 2){
ans += "A";
}else if((val-old)){
ans += "B";
}else{
ans += "X";
}
old++;N--;
}
val = press(ans+"B");
if(val == old+1){
ans += "B";
}else{
val = press(ans+"X");
if(val == old+1){
ans += "X";
}else{
ans += "A";
}
}
}
return ans;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t =1;
//cin >> t;
for(int i = 1; i <= t; i++){
//cout << "Case " << i << ": ";
solve();
}
}