Submission #552268

#TimeUsernameProblemLanguageResultExecution timeMemory
552268lethinh05Combo (IOI18_combo)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define oo 1000000007 #define ll long long #define ld long double #define ii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define mp make_pair #define vi vector<int> #define vii vector<ii> #define sz(a) (int)(a.size()) #define pb push_back #define fto(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) #define fdto(i, a, b) for (int i = (int)(a); i >= (int)(b); --i) #define bug(x) "["#x" = "<<(x)<<"] " #define maxN 100005 using namespace std; char chrs[] = {'A', 'B', 'X', 'Y'}; #ifdef LOCALME int press(string p) { cout << p << "\n"; fflush(stdout); int x; cin >> x; return x; } #elif int press(string p); #endif // LOCALME string guess_sequence(int n) { string s = ""; fto(i, 0, 3) { string p(1, chrs[i]); int matches = press(p); if (matches == 1) { s += chrs[i]; break; } } fto(i, 1, n-1) { fto(i, 0, 3) { string p = s + chrs[i]; int matches = press(p); if (matches == sz(p)) { s += chrs[i]; break; } } } return s; } int main() { #ifdef LOCALME int n; cin >> n; string res = guess_sequence(n); cout << res << "\n"; #endif return 0; }

Compilation message (stderr)

combo.cpp:31:6: error: #elif with no expression
   31 | #elif
      |      ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:23: error: 'press' was not declared in this scope
   39 |         int matches = press(p);
      |                       ^~~~~
combo.cpp:49:27: error: 'press' was not declared in this scope
   49 |             int matches = press(p);
      |                           ^~~~~