Submission #443836

#TimeUsernameProblemLanguageResultExecution timeMemory
443836maximath_1Combo (IOI18_combo)C++11
100 / 100
45 ms584 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N){ string res=""; if(press("AB")>=1){ if(press("A")) res="A"; else res="B"; }else{ if(press("X")) res="X"; else res="Y"; } if(N==1) return res; vector<char>c={'A','B','X','Y'}; c.erase(find(c.begin(), c.end(), res[0])); while(res.size()<=N-2){ int op=press(res+c[0]+c[0] +res+c[0]+c[1] +res+c[1]+c[0]); if(op==res.size()){ res=res+c[2]; }else if(op==res.size()+1){ op=press(res+c[1]+c[2]); if(op==res.size()) res=res+c[0]+c[2]; else if(op==res.size()+1) res=res+c[1]+c[1]; else res=res+c[1]+c[2]; }else{ op=press(res+c[0]+c[1]); if(op==res.size()) res=res+c[1]+c[0]; else if(op==res.size()+1) res=res+c[0]+c[0]; else res=res+c[0]+c[1]; } } while(res.size()!=N){ if(press(res+c[0])==res.size()+1) res=res+c[0]; else if(press(res+c[1])==res.size()+1) res=res+c[1]; else res=res+c[2]; } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |  while(res.size()<=N-2){
      |        ~~~~~~~~~~^~~~~
combo.cpp:19:8: 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(op==res.size()){
      |      ~~^~~~~~~~~~~~
combo.cpp:21:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   }else if(op==res.size()+1){
      |            ~~^~~~~~~~~~~~~~
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(op==res.size()) res=res+c[0]+c[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(op==res.size()+1) res=res+c[1]+c[1];
      |            ~~^~~~~~~~~~~~~~
combo.cpp:28:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |    if(op==res.size()) res=res+c[1]+c[0];
      |       ~~^~~~~~~~~~~~
combo.cpp:29:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |    else if(op==res.size()+1) res=res+c[0]+c[0];
      |            ~~^~~~~~~~~~~~~~
combo.cpp:33:18: 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(res.size()!=N){
      |        ~~~~~~~~~~^~~
combo.cpp:34:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   if(press(res+c[0])==res.size()+1) res=res+c[0];
      |      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:35:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   else if(press(res+c[1])==res.size()+1) res=res+c[1];
      |           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...