Submission #734754

#TimeUsernameProblemLanguageResultExecution timeMemory
734754CutebolCombo (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std ; string guess_sequence( int n ) { string ans = "" ; vector <char> vec = { 'A' , 'B' , 'X' , 'Y' } ; int f = 0 ; int x = press ( "AB" ) ; if (x>0){ x = press("A") ; if(x>0) f = 0 ; else f = 1 ; } else{ x = press("X") ; if(x>0) f = 2 ; else f = 3 ; } ans += vec[f] ; swap ( vec[3] , vec[f] ) ; for ( int i = 1 ; i < n-1 ; i ++ ){ string cur ; for ( int j = 0 ; j < 3 ; j ++ ) cur += ans+vec[0]+vec[j] ; cur += ans+vec[1] ; x = press(cur) ; if ( x == ans.size() ) ans += vec[2] ; else if ( x-1 == ans.size() ) ans += vec[1] ; else ans += vec[0] ; } x = press( ans+vec[0]+ans+vec[1] ) ; if ( x == ans.size() ) ans += vec[2] ; else{ x = press(ans+vec[0]) ; if(x>ans.size()) ans += vec[0] ; else ans += vec[1] ; } return ans ; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   if ( x == ans.size() ) ans += vec[2] ;
      |        ~~^~~~~~~~~~~~~
combo.cpp:27:17: 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 ( x-1 == ans.size() ) ans += vec[1] ;
      |             ~~~~^~~~~~~~~~~~~
combo.cpp:31:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  if ( x == ans.size() ) ans += vec[2] ;
      |       ~~^~~~~~~~~~~~~
combo.cpp:34:7: 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(x>ans.size()) ans += vec[0] ;
      |      ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...