Submission #1064730

#TimeUsernameProblemLanguageResultExecution timeMemory
1064730vjudge1Combo (IOI18_combo)C++17
5 / 100
1 ms428 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string str="",ans=""; str+="AB"; int x=press(str); if(x>=1) { if(press("A")) ans+="A"; else ans+="B"; } else { if(press("X")) ans+="X"; else ans+="Y"; } str=""; if(ans=="X") str="ABY"; else if(ans=="Y") str="ABX"; else if(ans=="A") str="BXY"; else str="AXY"; for(int i=2;i<=(n-2);i++) { string now=ans+str[0]+str[1]+ans+str[0]+str[0]+ans+str[0]+str[2]+ans+str[1]; int temp=press(now); if(temp==ans.length()) { ans+=str[2]; } else if(temp==ans.length()+1) { ans+=str[1]; } else ans+=str[0]; //cout<<ans<<endl; } if(press(ans+str[0])==n-1) ans+=str[0]; else if(press(ans+str[1])==n-1) ans+=str[1]; else ans+=str[2]; if(press(ans+str[0])==n) ans+=str[0]; else if(press(ans+str[1])==n) ans+=str[1]; else ans+=str[2]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         if(temp==ans.length())
      |            ~~~~^~~~~~~~~~~~~~
combo.cpp:40:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         else if(temp==ans.length()+1)
      |                 ~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...