Submission #756779

#TimeUsernameProblemLanguageResultExecution timeMemory
756779andrei_marciucCombo (IOI18_combo)C++14
5 / 100
1 ms220 KiB
#include <iostream> #include <cstring> #include "combo.h" using namespace std; string guess_sequence( int N ) { string s, rest; if( press( "AB" ) > 0 ) if( press( "A" ) == 1 ) { s = "A"; rest = "BXY"; } else { s = "B"; rest = "AXY"; } else if( press( "X" ) == 1 ) { s = "X"; rest = "ABY"; } else { s = "Y"; rest = "ABX"; } while( s.size() < N - 1 ) { int length = press( s + rest[ 0 ] + s + rest[ 1 ] + rest[ 0 ] + s + rest[ 1 ] + rest[ 1 ] + s + rest[ 1 ] + rest[ 2 ] ); if( s.size() == length - 1 ) s = s + rest[ 0 ]; else if( s.size() == length - 2 ) s = s + rest[ 1 ]; else s = s + rest[ 2 ]; } if( s.size() != press( s + rest[ 0 ] ) ) s = s + rest[ 0 ]; else if( s.size() != press( s + rest[ 1 ] ) ) s = s + rest[ 1 ]; else s = s + rest[ 2 ]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     while( s.size() < N - 1 ) {
      |            ~~~~~~~~~^~~~~~~
combo.cpp:26:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |         if( s.size() == length - 1 )
      |             ~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:29:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         else if( s.size() == length - 2 )
      |                  ~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:34:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     if( s.size() != press( s + rest[ 0 ] ) )
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
combo.cpp:36:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     else if( s.size() != press( s + rest[ 1 ] ) )
      |              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...