제출 #796997

#제출 시각아이디문제언어결과실행 시간메모리
796997polya콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; char d[4] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N) { string seq; int ans = 0, data; for (int i=0; i<3; i++) { string a; a.push_back(d[i]); ans = press(a); if (ans == 1) { data = i; seq.push_back(d[i]); break; } } if (ans == 0) { seq.push_back(d[3]); for (int i=1; i<N; i++) { string a = seq; a.push_back('A'); ans = press(a); if (ans == a.size()) seq.push_back('A'); else { string b = seq; b.push_back('B'); ans = press(b); if (ans == b.size()) seq.push_back('B'); else seq.push_back('X'); } } } else { for (int i=1; i<N; i++) { for (int j=0; j<2; j++) { if (j != data) { string a = seq; a.push_back(d[j]); ans = press(a); if (ans == a.size()) { seq.push_back(d[j]); break; } } } if (seq.size() != i+1) seq.push_back('Y'); } } return seq; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:18: error: 'press' was not declared in this scope
   12 |            ans = press(a);
      |                  ^~~~~
combo.cpp:23:26: error: 'press' was not declared in this scope
   23 |                    ans = press(a);
      |                          ^~~~~
combo.cpp:24:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |                    if (ans == a.size()) seq.push_back('A');
      |                        ~~~~^~~~~~~~~~~
combo.cpp:28:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |                         if (ans == b.size()) seq.push_back('B');
      |                             ~~~~^~~~~~~~~~~
combo.cpp:39:33: error: 'press' was not declared in this scope
   39 |                           ans = press(a);
      |                                 ^~~~~
combo.cpp:40:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |                           if (ans == a.size()) {
      |                               ~~~~^~~~~~~~~~~
combo.cpp:46:32: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   46 |                 if (seq.size() != i+1) seq.push_back('Y');
      |                     ~~~~~~~~~~~^~~~~~