Submission #497232

#TimeUsernameProblemLanguageResultExecution timeMemory
497232pakhomoveeCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <vector> using namespace std; int press(string p); vector<char> v = { 'A', 'B', 'X', 'Y' }; string guess_sequence(int N) { string res; for (int i = 0; i < 3; ++i) { string curr; curr += v[i]; if (press(curr)) { res += v[i]; break; } } v.erase(v.find(v.begin(), v.end(), res[0])); int ptr = 1; while (ptr + 1 < N) { string query = res; query += v[0]; query += res; query += v[1]; query += v[0]; query += res; query += v[1]; query += v[1]; query += res; query += v[1]; query += v[2]; int c = press(query); if (c) { res += v[2]; } else if (c == 1) { res += v[0]; } else { res += v[1]; } } if (ptr < N) { for (int i = 0; i < 3; ++i) { string curr = res; curr += v[i]; if (press(curr) == N) { res += v[i]; break; } } } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:15: error: 'class std::vector<char>' has no member named 'find'
   20 |     v.erase(v.find(v.begin(), v.end(), res[0]));
      |               ^~~~