제출 #1015826

#제출 시각아이디문제언어결과실행 시간메모리
1015826rythm_of_knight콤보 (IOI18_combo)C++14
5 / 100
1 ms372 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { int x; char c; string a = "ABXY", ans; x = press("AB"); if (x) { x = press("A"); if (x) c = 'A'; else c = 'B'; } else { x = press("X"); if (x) c = 'X'; else c = 'Y'; } a.erase(a.begin() + a.find(c)); ans.push_back(c); for (int i = 1; i < n - 1; i++) { string b = ans + a[1] + ans + a[0] + a[1] + ans + a[0] + a[0] + ans + a[0] + a[2]; x = press(b); if (x == ans.size() + 1) { ans += a[1]; } else if (x == ans.size() + 2) { ans += a[0]; } else { ans += a[2]; } } string b = ans + a[0] + ans + a[1]; x = press(b); if (x == ans.size() + 1) { b = ans + a[0]; x = press(b); if (x == ans.size() + 1) ans.push_back(a[0]); else ans.push_back(a[1]); } else { ans.push_back(a[2]); } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if (x == ans.size() + 1) {
      |             ~~^~~~~~~~~~~~~~~~~
combo.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         } else if (x == ans.size() + 2) {
      |                    ~~^~~~~~~~~~~~~~~~~
combo.cpp:39:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     if (x == ans.size() + 1) {
      |         ~~^~~~~~~~~~~~~~~~~
combo.cpp:42:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         if (x == ans.size() + 1)
      |             ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...