Submission #380441

#TimeUsernameProblemLanguageResultExecution timeMemory
380441Dan4LifeCombo (IOI18_combo)C++17
100 / 100
41 ms592 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string p = "AB", temp = "ABXY", x = ""; if(!press(p))p="XY"; if(!press(p.substr(0,1)))p=p[1]; else p = p[0]; for(auto u : temp) if(p[0]!=u)x+=u; if(N==1)return p; for(int i = 1; i < N-1; i++) { int num = press(p+x[0]+p+x[1]+x[0]+p+x[1]+x[1]+p+x[1]+x[2]); if(num==p.size()) p+=x[2]; else if(num==p.size()+1)p+=x[0]; else p+=x[1]; } if(press(p+x[0]+p+x[1])==p.size())p+=x[2]; else if(press(p+x[0])==p.size()+1)p+=x[0]; else p+=x[1]; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |       if(num==p.size()) p+=x[2];
      |          ~~~^~~~~~~~~~
combo.cpp:16:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |       else if(num==p.size()+1)p+=x[0];
      |               ~~~^~~~~~~~~~~~
combo.cpp:19:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   if(press(p+x[0]+p+x[1])==p.size())p+=x[2];
      |      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:20:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   else if(press(p+x[0])==p.size()+1)p+=x[0];
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...