Submission #477442

#TimeUsernameProblemLanguageResultExecution timeMemory
477442SlavicGCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long
 
#define       forn(i,n)              for(int i=0;i<n;i++)
#define          all(v)              v.begin(), v.end()
#define         rall(v)              v.rbegin(),v.rend()
 
#define            pb                push_back
#define          sz(a)               (int)a.size()

string guess_sequence(int n){
    string cur = "";
    vector<char> c;
    c.pb('X');
    c.pb('Y');
    c.pb('A');
    c.pb('B');
    char first = 'A';
    if(press("XY")){
        if(press("X"))first = 'X';
        else first = 'Y';
    }else{
        if(press("A"))first = 'A';
        else first = 'B';
    }
    c.erase(find(all(c), first));
    cur += first;

    for(int i = 1;i < n - 1;++i){
        string qr = cur;
        qr += c[0];
        qr += c[0];
        qr += cur;

        qr += c[0];
        qr += c[1];

        qr += cur;
        qr += c[0];
        qr += c[2];

        qr += cur;
        qr += c[1];

        if(press(qr) == 2){
            cur += c[0];
        }else if(press(qr) == 1){
            cur += c[1];
        }else{
            cur += c[2];
        }
    }

    if(press(cur + c[0]) == n)cur += c[0];
    else if(press(cur + c[1]) == n)cur += c[1];
    else cur += c[2]; 
    return cur;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:8: error: 'press' was not declared in this scope
   21 |     if(press("XY")){
      |        ^~~~~
combo.cpp:47:12: error: 'press' was not declared in this scope
   47 |         if(press(qr) == 2){
      |            ^~~~~
combo.cpp:56:8: error: 'press' was not declared in this scope
   56 |     if(press(cur + c[0]) == n)cur += c[0];
      |        ^~~~~