제출 #489491

#제출 시각아이디문제언어결과실행 시간메모리
489491Evang콤보 (IOI18_combo)C++17
5 / 100
2 ms200 KiB
#include <bits/stdc++.h> using namespace std; #include "combo.h" string guess_sequence(int n) { string ans; if(press("AB")==0){ if(press("X")) ans = "X"; else ans = "Y"; } else if(press("A")) ans = "A"; else ans = "B"; vector<string> v; for(const string &s: {"A", "B", "Y", "X"}) if(s!=ans){ v.push_back(s); } while(ans.size() + 1 < n){ int x = press(ans + v[0] + v[0] + ans + v[0] + v[1] + ans + v[0] + v[2] + ans + v[1]); if(x==ans.size()) ans += v[2]; else if(x==ans.size()+1) ans += v[1]; else ans += v[0]; } if(press(ans + v[0] + ans + v[1])==ans.size()+1){ if(press(ans+v[0])==ans.size()+1) return ans + v[0]; return ans + v[1]; } return ans + v[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |  while(ans.size() + 1 < n){
      |        ~~~~~~~~~~~~~~~^~~
combo.cpp:25:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   if(x==ans.size())
      |      ~^~~~~~~~~~~~
combo.cpp:27:12: 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==ans.size()+1)
      |           ~^~~~~~~~~~~~~~
combo.cpp:33:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  if(press(ans + v[0] + ans + v[1])==ans.size()+1){
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:34:21: 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(press(ans+v[0])==ans.size()+1)
      |      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...