제출 #974488

#제출 시각아이디문제언어결과실행 시간메모리
974488AliHasanli콤보 (IOI18_combo)C++17
100 / 100
17 ms2144 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string a="ABXY", b="AB", d, s; if(!press("AB")) b="XY"; char fc=b[0]; if(!press(b.substr(0, 1))) fc=b[1]; for(int i=0;i<a.size();i++) if(a[i]!=fc) d+=a[i]; s+=fc; if(n<=1) return s; while(s.size()<n-1) s+=d[press(s+d[1]+s+d[2]+d[0]+s+d[2]+d[1]+s+d[2]+d[2])-s.size()]; if(press(s+d[0]+s+d[1])>s.size()) { if(press(s+d[0])>s.size()) return s+d[0]; return s+d[1]; } return s+d[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int i=0;i<a.size();i++)
      |              ~^~~~~~~~~
combo.cpp:18:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |  while(s.size()<n-1)
      |        ~~~~~~~~^~~~
combo.cpp:20:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  if(press(s+d[0]+s+d[1])>s.size()) {
      |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
combo.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   if(press(s+d[0])>s.size())
      |      ~~~~~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...