Submission #998488

#TimeUsernameProblemLanguageResultExecution timeMemory
998488ezzzayCombo (IOI18_combo)C++14
100 / 100
20 ms1548 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back std::string guess_sequence(int N) { string s; vector<string>h={"A","B","X","Y"}; if(press(h[0]+h[1])){ if(press(h[1]))swap(h[0],h[1]); } else if(press(h[2])){ swap(h[0],h[2]); } else{ swap(h[0],h[3]); } s+=h[0]; if(N==1)return s; for(int i=2;i<N;i++){ string tmp=s+h[1]+s+h[2]+h[1]+s+h[2]+h[2]+s+h[2]+h[3]; int t=press(tmp); if(t==s.size()+1){ s+=h[1]; } else if(t==s.size()+2){ s+=h[2]; } else{ s+=h[3]; } } if(press(s+h[1])==s.size()+1){ s+=h[1]; } else if(press(s+h[2])==s.size()+1){ s+=h[2]; } else{ s+=h[3]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     if(t==s.size()+1){
      |        ~^~~~~~~~~~~~
combo.cpp:27:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     else if(t==s.size()+2){
      |             ~^~~~~~~~~~~~
combo.cpp:34:19: 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(s+h[1])==s.size()+1){
      |      ~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:37:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   else if(press(s+h[2])==s.size()+1){
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...