제출 #96583

#제출 시각아이디문제언어결과실행 시간메모리
96583jhnah917콤보 (IOI18_combo)C++14
100 / 100
45 ms556 KiB
#include "combo.h" #include <vector> using namespace std; string guess_sequence(int n){ string S; if(press("AB")){ if(press("A")) S = "A"; else S = "B"; }else{ if(press("X")) S = "X"; else S = "Y"; } vector<string> v; if(S != "A") v.push_back("A"); if(S != "B") v.push_back("B"); if(S != "X") v.push_back("X"); if(S != "Y") v.push_back("Y"); string p = v[0], q = v[1], r = v[2]; for(int i=2; i<n; i++){ int sz = S.size(); int now = press(S+p+p + S+p+q + S+p+r + S+q); if(now == sz+2) S += p; else if(now == sz+1) S += q; else S += r; } if(n != 1){ if(press(S+p) > S.size()) S += p; else if(press(S+q) > S.size()) S += q; else S += r; } return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if(press(S+p) > S.size()) S += p;
      |      ~~~~~~~~~~~^~~~~~~~~~
combo.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   else if(press(S+q) > S.size()) S += q;
      |           ~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...