Submission #749959

#TimeUsernameProblemLanguageResultExecution timeMemory
749959CDuongCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
/* #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt") */ #include <bits/stdc++.h> #define taskname "" #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> using namespace std; const int mxN = 2e5 + 5; const int mod = 1e9 + 7; const ll oo = 1e18; char c[] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N) { int n = N; int cur = press("AB"); string s; if(cur == 1) { cur = press("A"); if(cur) s = "A"; else s = "B"; } else { cur = press("X"); if(cur) s = "X"; else s = "Y"; } vector<char> sadge; for(int i = 0; i < 4; ++i) if(c[i] != s[0]) sadge.emplace_back(c[i]); for(int i = (int)s.size(); i < n - 1; ++i) { tmp += s; tmp.pb(s[0]); tmp.pb(s[0]); tmp += s; tmp.pb(s[0]); tmp.pb(s[1]); tmp += s; tmp.pb(s[0]); tmp.pb(s[2]); tmp += s; tmp.pb(s[1]); int cur = press(tmp); if(tmp == i) s.pb(s[2]); else if(tmp - 1 == i) s.pb(s[1]); else s.pb(s[0]); } string tmp = s; tmp.pb(s[0]); if(press(tmp)) { s.pb(s[0]); return s; } tmp.pop_back(); tmp.pb(s[1]); if(press(tmp)) { s.pb(s[1]); return s; } s.pb(s[2]); return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:15: error: 'press' was not declared in this scope
   28 |     int cur = press("AB");
      |               ^~~~~
combo.cpp:47:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   47 |         tmp += s;
      |         ^~~
      |         tm
combo.cpp:58:13: warning: unused variable 'cur' [-Wunused-variable]
   58 |         int cur = press(tmp);
      |             ^~~