Submission #1191860

#TimeUsernameProblemLanguageResultExecution timeMemory
1191860p4r4d0_xCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { vector<char> a = {'A', 'B', 'X', 'Y'}; string s = ""; for(int i = 0; i < 4; ++i){ s += a[i]; if(press(s) == 1){ break; } else s = ""; } vector<char> b; for(int i = 0; i < 4; ++i){ if(a[i] != s[0]){ b.pb(a[i]); } } vector<string> vs; sort(begin(b), end(b)); do{ string st = ""; for(int i = 0; i < 3; ++i){ st += b[i]; } vs.pb(st); } while(next_permutation(begin(b), end(b))); ll cnt = 1; while(cnt != N){ if(cnt + 3 <= N){ for(auto &x : vs){ if(press(s + x) == cnt + 3){ s += x; cnt += 3; break; } } } else{ for(int i = 0; i < 4; ++i){ if(press(s + a[i]) == cnt + 1){ s += a[i]; cnt++; break; } } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:13: error: 'class std::vector<char>' has no member named 'pb'
   18 |           b.pb(a[i]);
      |             ^~
combo.cpp:28:10: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'pb'
   28 |       vs.pb(st);
      |          ^~
combo.cpp:31:3: error: 'll' was not declared in this scope
   31 |   ll cnt = 1;
      |   ^~
combo.cpp:32:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   32 |   while(cnt != N){
      |         ^~~
      |         int