Submission #1278670

#TimeUsernameProblemLanguageResultExecution timeMemory
1278670IBoryCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string P = "ABXY"; int n = press("AB"); char c = ' '; if (n) c = (press("A") ? 'A' : 'B'); else c = (press("X") ? 'X' : 'Y'); P.erase(P.begin() + P.find(c)); string S; S.push_back(c); string P1, P21, P22, P23; P1.push_back(P[0]); P21.push_back(P[1]); P21.push_back(P[0]); P22.push_back(P[1]); P22.push_back(P[1]); P23.push_back(P[1]); P23.push_back(P[2]); for (int i = 2; i < N; ++i) { string T = S + P1 + S + P21 + S + P22 + S + P23; int n = press(T); if (n == (i - 1)) S.push_back(P[2]); else if (n == i) S.push_back(P[0]); else S.push_back(P[1]); } for (int i = 0; i < 3; ++i) { S.push_back(P[i]); if (i == 2 || guess(S) == N) return S; S.pop_back(); } return ""; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:31: error: 'guess' was not declared in this scope
   30 |                 if (i == 2 || guess(S) == N) return S;
      |                               ^~~~~