Submission #1290018

#TimeUsernameProblemLanguageResultExecution timeMemory
1290018orucCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "combo.h" string guess_sequence(int N){ string ans = ""; char ilk = ' '; if(N > 1){ int ab = press("AB"); int ax = press("AX"); if(ab == 0){ if(ax == 0){ ans = "Y"; } else if(ax == 1){ ans = "X"; } else{ ans = "A"; } } else if(ab == 1){ if(ax == 0){ ans = "B"; } else if(ax == 1){ ans = "A"; } else{ ans = "A"; } } else{ ans = "A"; } ilk = ans[0]; } else{ int ok = press("A"); if(ok){ return "A"; } ok = press("B"); if(ok){ return "B"; } ok = press("X"); if(ok){ return "X"; } return "Y"; } vector<char> v; for(char j: {'A','B','X','Y'}){ if(j == ilk) continue; v.pb(j); } for(int i = 2; i <= N-1; i++){ int ok = press(ans + v[0] + ans + v[1] + v[0] + ans + v[1] + v[1] + ans + v[1] + v[2]); if(ok == i){ ans += v[0]; } else if(ok == i-1){ ans += v[2]; } else{ ans += v[1]; } } int ok = press(ans + "A" + ans + "B"); if(ok == n){ ok = press(ans + "A"); if(ok == n){ ans += "A"; } else{ ans += "B"; } } else{ ok = press(ans + "X"); if(ok == n){ ans += "X"; } else{ ans += "Y"; } } //cout << ans << endl; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:60:11: error: 'class std::vector<char>' has no member named 'pb'
   60 |         v.pb(j);
      |           ^~
combo.cpp:76:14: error: 'n' was not declared in this scope
   76 |     if(ok == n){
      |              ^