제출 #713264

#제출 시각아이디문제언어결과실행 시간메모리
713264europium콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <numeric> #include <cmath> #include <iterator> #include <set> #include <map> #include <math.h> #include <iomanip> #include <unordered_set> using namespace std; string guess_sequence(int n) { vector<string> moves = {"A", "B", "X", "Y"}; string s = ""; for (int i = 0; i < 3; i++){ string guess = moves[i]; if (press(guess) == 1){ s += moves[i]; auto it = find(moves.begin(), moves.end(), guess); moves.erase(it); break; } } while (s.size() < n - 1){ string guess = s + moves[0] + s + moves[1] + moves[0] + s + moves[1] + moves[1] + s + moves[1] + moves[2]; int coins = press(guess); if (coins == s.size()) s += moves[2]; else if (coins == s.size() + 1) s += moves[0]; else if (coins == s.size() + 2) s += moves[1]; } for (int i = 0; i < 3; i++){ string guess = s + moves[i]; if (press(guess) == s.size() + 1){ s += moves[i]; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:13: error: 'press' was not declared in this scope
   23 |         if (press(guess) == 1){
      |             ^~~~~
combo.cpp:32:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |     while (s.size() < n - 1){
      |            ~~~~~~~~~^~~~~~~
combo.cpp:34:21: error: 'press' was not declared in this scope
   34 |         int coins = press(guess);
      |                     ^~~~~
combo.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         if (coins == s.size()) s += moves[2];
      |             ~~~~~~^~~~~~~~~~~
combo.cpp:37:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         else if (coins == s.size() + 1) s += moves[0];
      |                  ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:38:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         else if (coins == s.size() + 2) s += moves[1];
      |                  ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:44:13: error: 'press' was not declared in this scope
   44 |         if (press(guess) == s.size() + 1){
      |             ^~~~~