Submission #137978

#TimeUsernameProblemLanguageResultExecution timeMemory
137978MoNsTeR_CuBeCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "combo.h" using namespace std; vector< char > guess{'A', 'B', 'X', 'Y'}; void recur(string &pref, int index){ if(index == 0) return; string s = ""; s = pref + guess[0] + pref + guess[1] + guess[0] + pref + guess[1] + guess[1] + pref + guess[1] + guess[2]; int rep = press(s); if(rep == (int)pref.size()){ pref += guess[2]; recur(pref, index - 1); }else if(rep == (int)pref.size()+1){ pref = (pref + guess[0]); recur(pref, index - 1); }else{ pref = (pref + guess[1]); recur(pref, index - 1); } } string guess_sequence(int N) { string s = "AB"; if(press(s)){ s = "A"; if(!press(s)){ s = "B"; } }else{ s = "X"; if(!press(s)){ s = "Y"; } } for(int i = 0; i < 4; i++){ if(s[0] == guess[i]){ swap(guess[i], guess.back()); guess.pop_back(); break; } } recur(s, N-2); s += guess[0]; if(press(s) == N){ return s; } s.back() = guess[1]; if(press(s) == N) return s; s.back() = guess[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'void recur(std::string&, int)':
combo.cpp:14:12: error: 'press' was not declared in this scope
   14 |  int rep = press(s);
      |            ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:5: error: 'press' was not declared in this scope
   29 |  if(press(s)){
      |     ^~~~~
combo.cpp:51:5: error: 'press' was not declared in this scope
   51 |  if(press(s) == N){
      |     ^~~~~
combo.cpp:55:5: error: 'press' was not declared in this scope
   55 |  if(press(s) == N) return s;
      |     ^~~~~