Submission #349118

#TimeUsernameProblemLanguageResultExecution timeMemory
349118spike1236Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; bool check(char x) { string s = ""; s += x; int cnt = press(s); if(cnt > 1 || !cnt) return 0; return 1; } string guess_sequence(int n) { string cur = ""; set <char> st; st.insert('A'); st.insert('B'); st.insert('X'); st.insert('Y'); if(check('A')) cur = "A", st.erase('A'); else if(check('B')) cur = "B", st.erase('B'); else if(check('X')) cur = "X", st.erase('X'); else cur = "Y", st.erase('Y'); auto it = st.begin(); vector <char> a; a.pb(*it); ++it; a.pb(*it); ++it; a.pb(*it); for(int i = 1; i < n; ++i) { veci was(3); for(int j = 0; j < 2; ++j) { int key = rand() % 3; while(was[key]) key = rand() % 3; if(press(cur + a[key]) == i + 1) { cur += a[key]; break; } was[key] = 1; } } return cur; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:7: error: 'class std::vector<char>' has no member named 'pb'
   26 |     a.pb(*it);
      |       ^~
combo.cpp:28:7: error: 'class std::vector<char>' has no member named 'pb'
   28 |     a.pb(*it);
      |       ^~
combo.cpp:30:7: error: 'class std::vector<char>' has no member named 'pb'
   30 |     a.pb(*it);
      |       ^~
combo.cpp:32:9: error: 'veci' was not declared in this scope
   32 |         veci was(3);
      |         ^~~~
combo.cpp:35:19: error: 'was' was not declared in this scope
   35 |             while(was[key]) key = rand() % 3;
      |                   ^~~
combo.cpp:40:13: error: 'was' was not declared in this scope
   40 |             was[key] = 1;
      |             ^~~