Submission #86950

#TimeUsernameProblemLanguageResultExecution timeMemory
86950AlexPop28Combo (IOI18_combo)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define all(cont) cont.begin(), cont.end() #define pb push_back #define fi first #define se second #define DEBUG(x) cerr << (#x) << ": " << (x) << '\n' #include "combo.h" using namespace std; typedef pair <int, int> pii; typedef vector <int> vi; typedef long long ll; typedef unsigned long long ull; string guess_sequence (int N) { string p = "", cand = ""; int aux = press ("AB"); p = press ("AB") ? (press ("A") ? "A" : "B") : (press ("X") ? "X" : "Y"); for (char c : "ABXY") { if (c == p[0]) continue; cand += c; } for (int i = 2; i <= N - 1; ++i) { s = p + cand[0] + p + cand[1] + cand[0] + p + cand[1] + cand[1] + p + cand[1] + cand[2]; aux = press (s); if (aux == i - 1) { p += cand[2]; } else if (aux == i) { p += cand[0]; } else { p += cand[1]; } } for (int i = 0; i < 3; ++i) { aux = press (p + cand[i]); if (aux == n) return (p + cand[i]); } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:9: error: 's' was not declared in this scope
   26 |         s = p + cand[0] + p + cand[1] + cand[0] + p + cand[1] + cand[1] + p + cand[1] + cand[2];
      |         ^
combo.cpp:39:20: error: 'n' was not declared in this scope
   39 |         if (aux == n) return (p + cand[i]);
      |                    ^
combo.cpp:17:16: warning: control reaches end of non-void function [-Wreturn-type]
   17 |     string p = "", cand = "";
      |                ^~