Submission #370880

#TimeUsernameProblemLanguageResultExecution timeMemory
370880mahmoudbadawyCombo (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { string cur=""; if(press("AB")) { if(press("A")) cur="A"; else cur="B"; } else { if(press("X")) cur="X"; else cur="Y"; } string v="ABXY"; for(int i=0;i<v.size();i++) if(v[i]==cur[0]) {v.erase(v.begin()+i); break;} for(int i=1;i+1<N;i++) { string a=cur+v[0]; for(int i=0;i<v.size();i++) a+=(cur+v[1])+v[i]; int p=press(a); if(p==cur.size()) cur+=v[2]; else if(p==cur.size()+1) cur+=v[0]; else cur+=v[1]; } for(int i=0;i+1<v.size();i++) {if(press(cur+v[i])==N) cur+=v[i]; break;} if(cur.size()!=N) cur+=v[2]; return cur; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |   for(int i=0;i<v.size();i++) if(v[i]==cur[0]) {v.erase(v.begin()+i); break;}
      |               ~^~~~~~~~~
combo.cpp:20:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
combo.cpp:23:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if(p==cur.size()) cur+=v[2];
      |        ~^~~~~~~~~~~~
combo.cpp:24:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     else if(p==cur.size()+1) cur+=v[0];
      |             ~^~~~~~~~~~~~~~
combo.cpp:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int i=0;i+1<v.size();i++) {if(press(cur+v[i])==N) cur+=v[i]; break;}
      |               ~~~^~~~~~~~~
combo.cpp:28:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   if(cur.size()!=N) cur+=v[2];
      |      ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...