Submission #540133

#TimeUsernameProblemLanguageResultExecution timeMemory
540133Ronin13Combo (IOI18_combo)C++14
5 / 100
2 ms296 KiB
#include "combo.h"
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;

const int inf = 1e9 + 1;
const ll linf = 1e18 + 1;
const int mod = 1e9 + 7;
std::string guess_sequence(int N) {
    int n=N;
    string cur = "";
    int c = press("AB");
    if(c>=1){
        c = press("A");
        if(c == 1)cur += 'A';
        else cur += 'B';
    }
    else{
        c = press("X");
        if(c == 1)cur += "X";
        else cur += 'Y';
    }
    vector<char>s;
    if(cur[0] != 'A')s.pb('A');
    if(cur[0] != 'B')s.pb('B');
    if(cur[0] != 'X')s.pb('X');
    if(cur[0] != 'Y')s.pb('Y');
    for(int i=2;i<n;i++){
        string p="";
       // p  = cur;
            for(int j = 0; j < 3; j++){
                string x = "";
                x += s[0];
                x += s[j];
                p += cur;
                p += x;
            }
        p += cur;
        p += s[1];
        int c = press(p);
        if(c == i + 1){
            cur += s[0];
        }
        if(c==i){
            cur += s[1];
        }
        if(c < i){
            cur += s[2];
        }
    }
    c = press(cur + s[0] + cur + s[1]);
    if(c == n){
        c = press(cur + s[0]);
        if(c == n)cur += s[0];
        else cur += s[1];
    }
    else cur += s[2];
    return cur;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...