제출 #526949

#제출 시각아이디문제언어결과실행 시간메모리
526949lcs147콤보 (IOI18_combo)C++17
100 / 100
44 ms620 KiB
#include<bits/stdc++.h> #include"combo.h" using namespace std; string guess_sequence(int n) { string ch = "ABXY"; int id = -1; int sz = press("AB"); if(sz) { sz = press("A"); if(sz) id = 0; else id = 1; } else { sz = press("X"); if(sz) id = 2; else id = 3; } string res = string(1, ch[id]); ch.erase(id, 1); auto allch = ch; while(res.size() < n-1) { int sz = press(res + ch[0] + res + ch[1]+ch[0] + res + ch[1]+ch[1] + res + ch[1]+ch[2]); int id = -1; if(sz == res.size()+1) id = 0; else if(sz == res.size()+2) id = 1; else id = 2; res += ch[id]; } if(res.size() < n) { int id = ch.size()-1; for(int i=0; i<ch.size()-1; i++) { int sz = press(res + ch[i]); if(sz > res.size()) { id = i; break; } } res += ch[id]; } return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     while(res.size() < n-1) {
      |           ~~~~~~~~~~~^~~~~
combo.cpp:28:15: 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(sz == res.size()+1) id = 0;
      |            ~~~^~~~~~~~~~~~~~~
combo.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         else if(sz == res.size()+2) id = 1;
      |                 ~~~^~~~~~~~~~~~~~~
combo.cpp:35:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |     if(res.size() < n) {
      |        ~~~~~~~~~~~^~~
combo.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for(int i=0; i<ch.size()-1; i++) {
      |                      ~^~~~~~~~~~~~
combo.cpp:39:19: 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(sz > res.size()) {
      |                ~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...