Submission #241312

#TimeUsernameProblemLanguageResultExecution timeMemory
241312WhaleVomitCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define sz(v) (int)v.size() #define MOO(i, a, b) for(int i=a; i<b; i++) #define M00(i, a) for(int i=0; i<a; i++) #define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--) #define M00d(i,a) for(int i = (a)-1; i>=0; i--) #define FAST ios::sync_with_stdio(0); cin.tie(0); #define finish(x) return cout << x << '\n', 0; #define dbg(x) cerr << ">>> " << #x << " = " << x << "\n"; #define _ << " _ " << typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef pair<int,int> pi; typedef pair<ld,ld> pd; typedef complex<ld> cd; /*string cur; int press(string p) { int cnt = 0; int mx = 0; for(char c: p) { if(cnt >= sz(cur)) return sz(cur); if(cur[cnt] == c) cnt++; else cnt = 0; mx = max(mx, cnt); } return mx; }*/ string guess_sequence(int n) { vector<string> chars; chars.pb("A"); chars.pb("B"); chars.pb("X"); chars.pb("Y"); string firstChar = ""; if(press("AB")) { if(press("A")) firstChar = "A"; else firstChar = "B"; } else { if(press("X")) firstChar = "X"; else firstChar = "Y"; } if(n == 1) return firstChar; vector<string> otherChars; M00(i, 4) if(chars[i] != firstChar) otherChars.pb(chars[i]); string res = firstChar; M00(i, n-2) { string ask = ""; ask += res + otherChars[0]; ask += res + otherChars[1] + otherChars[0]; ask += res + otherChars[1] + otherChars[1]; ask += res + otherChars[1] + otherChars[2]; int x = press(ask); if(x == sz(res)) res += otherChars[2]; else if(x == sz(res)+1) res += otherChars[0]; else res += otherChars[1]; } if(press(res+otherChars[0]) == n) res += otherChars[0]; else if(press(res+otherChars[1]) == n) res += otherChars[1]; else res += otherChars[2]; return res; } /*string runtest(string s) { cur = s; return guess_sequence(sz(s)); } int main() { FAST vector<string> tests; tests.pb("ABXYY"); tests.pb("A"); tests.pb("B"); tests.pb("X"); tests.pb("Y"); tests.pb("AB"); tests.pb("XB"); tests.pb("YA"); tests.pb("ABBBXXYXX"); for(string s: tests) { if(s == runtest(s)) { cout << "OK\n"; } else { cout << "BAD\n"; } } }*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:8: error: 'press' was not declared in this scope
   45 |     if(press("AB")) {
      |        ^~~~~
combo.cpp:62:17: error: 'press' was not declared in this scope; did you mean 'res'?
   62 |         int x = press(ask);
      |                 ^~~~~
      |                 res
combo.cpp:67:8: error: 'press' was not declared in this scope; did you mean 'res'?
   67 |     if(press(res+otherChars[0]) == n) res += otherChars[0];
      |        ^~~~~
      |        res