제출 #906461

#제출 시각아이디문제언어결과실행 시간메모리
906461Andrei_ierdnA콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <cstring> #include <string> using namespace std; string guess_sequence(int n) { string guess; string available; int rez; // first character rez = press("AB"); if (rez == 1) { rez = press("A"); if (rez) { guess.push_back('A'); available = "BXY"; } else { guess.push_back('B'); available = "AXY"; } } else { rez = press("X"); if (rez) { guess.push_back('X'); available = "ABY"; } else { guess.push_back('Y'); available = "ABX"; } } // contained characters for (int i = 2; i < n; i++) { string aux; aux = guess + available[0]; for (int j = 0; j <= 2; j++) { aux = aux + guess + available[1] + available[j]; } rez = press(aux) - guess.length(); if (rez == 1) { guess.push_back(available[0]); } else if (rez == 2) { guess.push_back(available[1]); } else { guess.push_back(available[2]); } } // end character rez = press(guess + available[0]); if (rez == n) { return guess + available[0]; } rez = press(guess + available[1]); if (rez == n) { return guess + available[1]; } return guess + available[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:11: error: 'press' was not declared in this scope
   13 |     rez = press("AB");
      |           ^~~~~