제출 #937046

#제출 시각아이디문제언어결과실행 시간메모리
937046Yazan_SA콤보 (IOI18_combo)C++14
100 / 100
13 ms1732 KiB
#include<bits/stdc++.h> #include"combo.h" using namespace std; std::string guess_sequence(int N) { std::string ans=""; std::string bts="ABXY"; int mx=1; ans+=(press(ans+bts[0]+bts[1])?press(ans+bts[0])?bts[0]:bts[1]:(press(ans+bts[2])?bts[2]:bts[3])); bts.erase(bts.begin()+bts.find(ans[0])); while((int)ans.size()!=N) { //cout<<ans+bts[0]+ans+bts[1]+bts[0]+ans+bts[1]+bts[1]+ans+bts[1]+bts[2]<<endl; if((int)ans.size()+1==N){ if(press(ans+bts[0]+ans+bts[1])>(int)ans.size()) { if(mx!=press(ans+bts[0]))ans+=bts[0]; else ans+=bts[1]; } else ans+=bts[2]; } else{ int tm=press(ans+bts[0]+ans+bts[1]+bts[0]+ans+bts[1]+bts[1]+ans+bts[1]+bts[2]); if(tm>(int)ans.size()) { if(tm-2==ans.size())ans+=bts[1]; else ans+=bts[0]; } else ans+=bts[2]; } mx=ans.size(); } return ans; } //int main() //{ // string s="abcd"; // s.erase(s.begin()+s.find('a')); // cout<<s; //}

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

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