Submission #1268814

#TimeUsernameProblemLanguageResultExecution timeMemory
1268814MunkhErdeneCombo (IOI18_combo)C++17
0 / 100
0 ms408 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define BC ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define _ << " " <<
string guess_sequence(int n){
    string s = "";
    int x = press("AB");
    int y = press("BX");
    if(x == 2) s.pb('A');
    else if(y == 2) s.pb('B');
    else if(x == 1 && y == 1) s.pb('B');
    else if(x == 1) s.pb('A');
    else if(y == 1) s.pb('X');
    else s.pb('Y');
    vector<char> chr({'A', 'B', 'X', 'Y'});
    for(int i = 0; i < 4; i++){
        if(chr[i] == s[0]){
            chr.erase(chr.begin() + i);
            break;
        }
    }
    for(int i = 1; i < n - 1; i++){
        string a = s;
        a.pb(chr[0]);
        a += s;
        a.pb(chr[1]); a.pb(chr[0]);
        a += s;
        a.pb(chr[1]); a.pb(chr[1]);
        a += s;
        a.pb(chr[1]); a.pb(chr[2]);
        cout << i << endl;
        ll x = press(a);
        if(x == i + 1) s.pb(chr[0]);
        else if(x == i + 2) s.pb(chr[1]);
        else s.pb(chr[2]);
    }
    string a = s;
    a.pb(chr[0]);
    a += s;
    a.pb(chr[1]);
    x = press(a);
    a = s;
    a.pb(chr[0]);
    y = press(a);
    if(x == n){
        s.pb(y == n ? chr[0] : chr[1]);
    }
    else s.pb(chr[2]);
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...