Submission #77192

#TimeUsernameProblemLanguageResultExecution timeMemory
77192toreto_backCombo (IOI18_combo)C++14
100 / 100
65 ms568 KiB
#include "combo.h" #include <bits/stdc++.h> #define F first #define S second using namespace std; typedef long long ll; typedef double D; const ll mod=1e9+7; const ll inf=(1ll<<61); const int MX=3e5+9; string guess_sequence(int n){ if(n==1){ if(press("A"))return "A"; if(press("B"))return "B"; if(press("X"))return "X"; return "Y"; } string p=""; string ans=""; if(press("AB")){ if(press("AYAXAB")==1)ans+='B'; else ans+='A'; } else{ if(press("XAXBXY")==1)ans+='Y'; else ans+='X'; } if(ans=="A")p="BXY"; if(ans=="B")p="AXY"; if(ans=="X")p="ABY"; if(ans=="Y")p="AXB"; while(ans.size()<n-1){ int x=press(ans+p[0]+p[0]+ans+p[0]+p[1]+ans+p[0]+p[2]+ans+p[1]); if(x==ans.size()+1){ ans+=p[1]; } else if(x==ans.size())ans+=p[2]; else ans+=p[0]; } if(press(ans+p[0])==n)return ans+p[0]; if(press(ans+p[1])==n)return ans+p[1]; return ans+p[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |     while(ans.size()<n-1){
      |           ~~~~~~~~~~^~~~
combo.cpp:35:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if(x==ans.size()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         else if(x==ans.size())ans+=p[2];
      |                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...