제출 #497233

#제출 시각아이디문제언어결과실행 시간메모리
497233pakhomovee콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <vector> #include <algorithm> 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; }

컴파일 시 표준 에러 (stderr) 메시지

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