제출 #1043340

#제출 시각아이디문제언어결과실행 시간메모리
1043340Zicrus콤보 (IOI18_combo)C++17
100 / 100
19 ms1048 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; typedef long long ll; string guess_sequence(int n) { string s; if (press("AB")) s = press("A") ? 'A' : 'B'; else s = press("X") ? 'X' : 'Y'; vector<char> c; if (s[0] != 'A') c.push_back('A'); if (s[0] != 'B') c.push_back('B'); if (s[0] != 'X') c.push_back('X'); if (s[0] != 'Y') c.push_back('Y'); if (n == 1) return s; while (s.size() < n-1) { string g = s + c[0] + s + c[1] + c[0] + s + c[1] + c[1] + s + c[1] + c[2]; int a = press(g); if (a == s.size()) s += c[2]; else if (a == s.size()+1) s += c[0]; else if (a == s.size()+2) s += c[1]; } if (press(s + c[0]) == n) return s + c[0]; if (press(s + c[1]) == n) return s + c[1]; return s + c[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     while (s.size() < n-1) {
      |            ~~~~~~~~~^~~~~
combo.cpp:25:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         if (a == s.size()) s += c[2];
      |             ~~^~~~~~~~~~~
combo.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         else if (a == s.size()+1) s += c[0];
      |                  ~~^~~~~~~~~~~~~
combo.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         else if (a == s.size()+2) s += c[1];
      |                  ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...