제출 #756779

#제출 시각아이디문제언어결과실행 시간메모리
756779andrei_marciuc콤보 (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; }

컴파일 시 표준 에러 (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...