제출 #1072566

#제출 시각아이디문제언어결과실행 시간메모리
1072566Rigobertus콤보 (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <queue> #include <string> //#define int long long #include "combo.h" using namespace std; string guess_sequence(int n) { string c[4] = {"A", "B", "X", "Y"}; string s; if (press("AB")) { s = "B"; if (press("A")) { s = "A"; } } else { s = "X"; if (press("Y")) { s = "Y"; } } vector<int> a; for (int i = 0; i < 4; i++) { if (c[i] != s) { a.push_back(i); } } while (s.size() < n) { string p = s + c[a[0]]; for (int i = 0; i < 3; i++) { p += s + c[a[1]] + c[a[i]]; } int x = press(p); if (x == s.size()) { s += c[a[2]]; } else if (x == s.size() + 1) { s += c[a[0]]; } else { s += c[a[1]]; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     while (s.size() < n) {
      |            ~~~~~~~~~^~~
combo.cpp:40:15: 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 (x == s.size()) {
      |             ~~^~~~~~~~~~~
combo.cpp:43:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         else if (x == s.size() + 1) {
      |                  ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...