제출 #294605

#제출 시각아이디문제언어결과실행 시간메모리
294605Autoratch콤보 (IOI18_combo)C++14
100 / 100
32 ms676 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans,ch = "ABXY",tmp; if(press("XY")) { if(press("X")) ans = "X"; else ans = "Y"; } else { if(press("A")) ans = "A"; else ans = "B"; } if(n==1) return ans; for(char c : ch) if(c!=ans[0]) tmp+=c; ch = tmp; for(int i = 1;i < n-1;i++) { tmp = ans+ch[0]+ch[0]+ans+ch[0]+ch[1]+ans+ch[0]+ch[2]+ans+ch[1]; int ret = press(tmp); if(ret==ans.length()+2) ans+=ch[0]; else if(ret==ans.length()+1) ans+=ch[1]; else ans+=ch[2]; } if(press(ans+ch[0])==n) return ans+ch[0]; else if(press(ans+ch[1])==n) return ans+ch[1]; else return ans+ch[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
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(ret==ans.length()+2) ans+=ch[0];
      |            ~~~^~~~~~~~~~~~~~~~
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(ret==ans.length()+1) ans+=ch[1];
      |                 ~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...