제출 #734750

#제출 시각아이디문제언어결과실행 시간메모리
734750Cutebol콤보 (IOI18_combo)C++17
5 / 100
1 ms228 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){ x = press("A") ; if(x) f = 0 ; else f = 1 ; } else{ x = press("X") ; if(x) 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 ; }

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