제출 #489490

#제출 시각아이디문제언어결과실행 시간메모리
489490Evang콤보 (IOI18_combo)C++17
0 / 100
0 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); cout<<s<<endl; } 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:24:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |  while(ans.size() + 1 < n){
      |        ~~~~~~~~~~~~~~~^~~
combo.cpp:26:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   if(x==ans.size())
      |      ~^~~~~~~~~~~~
combo.cpp:28:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   else if(x==ans.size()+1)
      |           ~^~~~~~~~~~~~~~
combo.cpp:34:35: 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 + v[1])==ans.size()+1){
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:35:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   if(press(ans+v[0])==ans.size()+1)
      |      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...