제출 #362149

#제출 시각아이디문제언어결과실행 시간메모리
362149penguinhacker콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array string guess_sequence(int n) { string ans; if (press("AB")) { if (press("A")) ans = "A"; else ans = "B"; } else { if (press("X")) ans = "X"; else ans = "Y"; } assert(ans.size() == 1); vector<char> v; if (ans != "A") v.push_back('A'); if (ans != "B") v.push_back('B'); if (ans != "X") v.push_back('X'); if (ans != "Y") v.push_back('Y'); assert(v.size() == 3); for (int i = 1; i < n - 1; ++i) { string s = ans + v[0] + v[0] + ans + v[0] + v[1] + ans + v[0] + v[2] + ans + v[1]; assert(s.size() <= 4 * n); int x = press(s); if (x == i) ans += v[2]; else if (x == i + 1) ans += v[1]; else if (x == i + 2) ans += v[0]; else assert(0); } assert(ans.size() == n - 1); if (press(ans + v[0]) == n) ans += v[0]; else if (press(ans + v[1]) == n) ans += v[1]; else ans += v[2]; assert(ans.size() == n); return ans; } /*int main() { ios::sync_with_stdio(0); cin.tie(0); return 0; } */

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:6: error: 'press' was not declared in this scope
    9 |  if (press("AB")) {
      |      ^~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:1:
combo.cpp:26:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |   assert(s.size() <= 4 * n);
      |          ~~~~~~~~~^~~~~~~~
combo.cpp:27:11: error: 'press' was not declared in this scope
   27 |   int x = press(s);
      |           ^~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:1:
combo.cpp:33:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |  assert(ans.size() == n - 1);
      |         ~~~~~~~~~~~^~~~~~~~
combo.cpp:34:6: error: 'press' was not declared in this scope
   34 |  if (press(ans + v[0]) == n) ans += v[0];
      |      ^~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:1:
combo.cpp:37:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |  assert(ans.size() == n);
      |         ~~~~~~~~~~~^~~~