Submission #1185080

#TimeUsernameProblemLanguageResultExecution timeMemory
1185080nikaa123Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> #define pb push_back using namespace std; string guess_sequence(int N) { int c; char v0; c = press("AB"); if (c) { c = press("B"); if (c) v0 = 'B'; else v0 = 'A'; } else{ c = press("X"); if (c) { v0 = 'X' } else { v0 = 'Y'; } } vector <char> v; if (v0 != 'A') v.pb('A'); if (v0 != 'B') v.pb('B'); if (v0 != 'Y') v.pb('Y'); if (v0 != 'X') v.pb('X'); string S = ""+v0; for (int i = 2; i <= n-1; i++) { string NS = S+v[0]+v[0]+S+v[0]+v[1]+S+v[0]+v[2]+S+v[1]; c = press(NS); if (c == i+1) { S = S + v[1]; } else if (c == i+2) { S = S+ v[0]; } else { S = S + v[2]; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:13: error: expected ';' before '}' token
   17 |     v0 = 'X'
      |             ^
      |             ;
   18 |    }  else {
      |    ~         
combo.cpp:30:24: error: 'n' was not declared in this scope
   30 |   for (int i = 2; i <= n-1; i++) {
      |                        ^