Submission #1105809

#TimeUsernameProblemLanguageResultExecution timeMemory
1105809magicianCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define MASK(i) (1ll << (i)) #define BIT(x, i) (((x) >> (i)) & 1) #define REP(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i) #define REPD(i, a, b) for(int i = (a), _b = (b); i >= _b; --i) #define ALL(v) (v).begin(), (v).end() #define SZ(v) (int)(v).size() #define PATHWA "A" #define fi first #define se second #define ll long long using namespace std; /* int press(string p) { const string S = "ABXYY"; int res = 0; REP(l, 1, SZ(S)) { REP(i, 0, SZ(p) - l) { if(S.substr(0, l) == p.substr(i, l)) { res = l; break; } } } return res; } */ string guess_sequence(int N) { vector<char> a = {'A', 'B', 'X', 'Y'}; string res, tmp; REP(i, 0, 2) { tmp.push_back(a[i]); if(press(tmp) == 1) { res.push_back(a[i]); break; } tmp.pop_back(); } if(res.empty()) { res.push_back(a[3]); tmp.push_back(a[3]); } vector<char> b; REP(i, 0, 3) if(res[0] != a[i]) b.push_back(a[i]); tmp = res; REP(l, 2, N) { REP(i, 0, 1) { tmp.push_back(b[i]); if(press(tmp) == l) { res.push_back(b[i]); break; } tmp.pop_back(); } if(SZ(res) < l) { res.push_back(b[2]); tmp.push_back(b[2]); } } return res; } int main(void) { /* ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(PATHWA".INP", "r")) { freopen(PATHWA".INP", "r", stdin); freopen(PATHWA".OUT", "w", stdout); }*/ return 0; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:12: error: 'press' was not declared in this scope; did you mean 'res'?
   35 |         if(press(tmp) == 1) {
      |            ^~~~~
      |            res
combo.cpp:53:16: error: 'press' was not declared in this scope; did you mean 'res'?
   53 |             if(press(tmp) == l) {
      |                ^~~~~
      |                res