Submission #1317902

#TimeUsernameProblemLanguageResultExecution timeMemory
1317902shangbinCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int N){
    vector<string> b = {"A", "B", "X", "Y"};
    string p, S = "";
    int first;
    if (press("XY") == 1){
        if (press("X") == 1) first = 2;
        else first = 3;
    }
    else {
        if (press("A") == 1) first = 0;
        else first = 1;
    }
    S += b[first];
    if (N == 1) return S;
    b.erase(b.begin() + first);
    for (int i = 1; i < N-1; i++){
        p = (S + b[1]) + (S + b[2] + b[0]) + (S + b[2] + b[1]) + (S + b[2] + b[2]);
        int coin = press(p);
        S += b[coin - S.length(a)];
    }
    if (press(S + b[0]) == N) S += b[0];
    else if (press(S + b[1]) == N) S += b[1];
    else S += b[2];
    return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:32: error: 'a' was not declared in this scope
   23 |         S += b[coin - S.length(a)];
      |                                ^