제출 #409262

#제출 시각아이디문제언어결과실행 시간메모리
409262Urvuk3콤보 (IOI18_combo)C++17
100 / 100
54 ms564 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(char c:a){ if(c!=fc) d+=c; } 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:16:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while(s.size()<n-1)
      |           ~~~~~~~~^~~~
combo.cpp:18:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     if(press(s+d[0]+s+d[1])>s.size()){
      |        ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
combo.cpp:19:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |        if(press(s+d[0])>s.size()) return s+d[0];
      |           ~~~~~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...