제출 #534448

#제출 시각아이디문제언어결과실행 시간메모리
534448YaserFaisal콤보 (IOI18_combo)C++17
30 / 100
49 ms704 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string call( string cur ) { int siz = cur.size()+1 ; if ( cur[0] == 'A' ) { if ( press(cur+'B') == siz ) return cur+'B' ; else if ( press(cur+'X') == siz ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'B' ) { if ( press(cur+'A') == siz ) return cur+'A' ; else if ( press(cur+'X') == siz ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'X' ) { if ( press(cur+'B') == siz ) return cur+'B' ; else if ( press(cur+'A') == siz ) return cur+'A' ; else return cur+'Y' ; } if ( cur[0] == 'Y' ) { if ( press(cur+'B') == siz ) return cur+'B' ; else if ( press(cur+'X') == siz ) return cur+'X' ; else return cur+'A' ; } } string guess_sequence (int n) { string cur = "" ; if ( press(cur+'A') == 1 ) cur+='A' ; else if ( press(cur+'B') == 1 ) cur+='B' ; else if ( press(cur+'X') == 1 ) cur+='X' ; else cur+='Y' ; while(cur.size()<n) cur = call(cur) ; return cur ; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |     while(cur.size()<n) cur = call(cur) ;
      |           ~~~~~~~~~~^~
combo.cpp: In function 'std::string call(std::string)':
combo.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...