제출 #216631

#제출 시각아이디문제언어결과실행 시간메모리
216631achvanov콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <combo.h> using namespace std; char c[] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int n) { string res = ""; for (int k = 0; k < 4; ++k) { res.clear(); res += c[k]; for (int i = 1; i < n; ++i) { ok = false; for (int j = 0; j < 4; ++j) { if (k != j and press(res + c[j]) > res.size()) { res += c[j]; ok = true; break; } } if (!ok) { break; } } if (res.size() == n) { return res; } } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:7: error: 'ok' was not declared in this scope; did you mean 'k'?
   14 |       ok = false;
      |       ^~
      |       k
combo.cpp:16:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         if (k != j and press(res + c[j]) > res.size()) {
      |                        ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:26:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |     if (res.size() == n) {
      |         ~~~~~~~~~~~^~~~
combo.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^