제출 #490789

#제출 시각아이디문제언어결과실행 시간메모리
490789CyberSleeper콤보 (IOI18_combo)C++14
100 / 100
39 ms560 KiB
#include "combo.h" #include <bits/stdc++.h> #define pb push_back using namespace std; int press(std::string p); string ch="ABXY", opt="XYBA"; int in; void ask(string s){ in=press(s); } string guess_sequence(int N) { string S, tmp; ask("AB"); if(in){ ask("A"); S=(in?"A":"B"); }else{ ask("X"); S=(in?"X":"Y"); } // 2 queries ch=""; for(auto i:opt) if(i!=S[0]) ch.pb(i); for(int i=2; i<N; i++){ ask(S+ch[0] + S+ch[1]+ch[0] + S+ch[1]+ch[1] + S+ch[1]+ch[2]); if(in==S.size()){ S.pb(ch[2]); }else if(in==(S.size()+1)){ S.pb(ch[0]); }else{ S.pb(ch[1]); } } if(S.size()<N){ ask(S+ch[0]); if(in==N) S.pb(ch[0]); else{ ask(S+ch[1]); S.pb((in==N)?ch[1]:ch[2]); } } return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if(in==S.size()){
      |            ~~^~~~~~~~~~
combo.cpp:33:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         }else if(in==(S.size()+1)){
      |                  ~~^~~~~~~~~~~~~~
combo.cpp:39:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |     if(S.size()<N){
      |        ~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...