제출 #144653

#제출 시각아이디문제언어결과실행 시간메모리
144653aanji콤보 (IOI18_combo)C++14
5 / 100
2 ms256 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string s; string a="A", b="B", c="X"; if(press("AB")) { if(press("A")) { s="A"; a="Y"; } else { b="Y"; s="B"; } } else { if(press("X")) { c="Y"; s="X"; } else s="Y"; } while(s.size()<N-1) { int k=press(s+a+s+b+a+s+b+b+s+b+c); if(k==s.size()) s+=c; else if(k==s.size()+1) s+=a; else s+=b; } if(press(s+a)==s.size()+1) return s+a; if(press(s+b)==s.size()+1) return s+b; return s+c; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |     while(s.size()<N-1) {
      |           ~~~~~~~~^~~~
combo.cpp:29:13: 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(k==s.size()) s+=c;
      |            ~^~~~~~~~~~
combo.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         else if(k==s.size()+1) s+=a;
      |                 ~^~~~~~~~~~~~
combo.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     if(press(s+a)==s.size()+1) return s+a;
      |        ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:34:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     if(press(s+b)==s.size()+1) return s+b;
      |        ~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...