Submission #152754

#TimeUsernameProblemLanguageResultExecution timeMemory
152754SegtreeCombo (IOI18_combo)C++14
97 / 100
37 ms624 KiB
#include<iostream> #include<algorithm> #include<vector> using namespace std; typedef long long ll; #define mod 1000000007 int press(string p); string guess_sequence(int N){ string d="ABXY"; string s="Y"; for(int r=0;r<3;r++){ string p=""; p+=d[r]; if(press(p)==1)s=p; } char fi=s[0]; string u=""; for(int r=0;r<4;r++){ if(d[r]!=fi)u+=d[r]; } ll i=1; for(;i<N-1;){ string p; p=s+u[0]+u[0]+fi+s+u[0]+u[1]+fi+s+u[1]+u[0]; int res=press(p); if(res==s.size()+0){ s+=u[2]; i++; continue; } if(res==s.size()+1){ p=s+u[1]+u[1]; int tap=press(p); if(tap==s.size()+0)s=s+u[0]+u[2]; if(tap==s.size()+1)s=s+u[1]+u[2]; if(tap==s.size()+2)s=s+u[1]+u[1]; i+=2; continue; } if(res==s.size()+2){ p=s+u[0]+u[0]; int tap=press(p); if(tap==s.size()+0)s=s+u[1]+u[0]; if(tap==s.size()+1)s=s+u[0]+u[1]; if(tap==s.size()+2)s=s+u[0]+u[0]; i+=2; } } if(i==N-1){ char res=u[2]; for(int i=0;i<2;i++){ string p=s+u[i]; if(press(p)==N)res=u[i]; } s+=res; } return s; }; /* int main(){ return 0; }*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  if(res==s.size()+0){
      |     ~~~^~~~~~~~~~~~
combo.cpp:32:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  if(res==s.size()+1){
      |     ~~~^~~~~~~~~~~~
combo.cpp:35:12: 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(tap==s.size()+0)s=s+u[0]+u[2];
      |         ~~~^~~~~~~~~~~~
combo.cpp:36:12: 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(tap==s.size()+1)s=s+u[1]+u[2];
      |         ~~~^~~~~~~~~~~~
combo.cpp:37:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |      if(tap==s.size()+2)s=s+u[1]+u[1];
      |         ~~~^~~~~~~~~~~~
combo.cpp:41:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  if(res==s.size()+2){
      |     ~~~^~~~~~~~~~~~
combo.cpp:44:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |      if(tap==s.size()+0)s=s+u[1]+u[0];
      |         ~~~^~~~~~~~~~~~
combo.cpp:45:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |      if(tap==s.size()+1)s=s+u[0]+u[1];
      |         ~~~^~~~~~~~~~~~
combo.cpp:46:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |      if(tap==s.size()+2)s=s+u[0]+u[0];
      |         ~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...