Submission #137977

#TimeUsernameProblemLanguageResultExecution timeMemory
137977MoNsTeR_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:23:25: error: expected ';' before '}' token
   23 |   recur(pref, index - 1)
      |                         ^
      |                         ;
   24 |  }
      |  ~                       
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:2: error: expected ',' or ';' before 'if'
   29 |  if(press(s)){
      |  ^~
combo.cpp:34:3: error: 'else' without a previous 'if'
   34 |  }else{
      |   ^~~~