제출 #436403

#제출 시각아이디문제언어결과실행 시간메모리
436403stoyan_malinin콤보 (IOI18_combo)C++14
30 / 100
67 ms456 KiB
#include <algorithm> #include <iostream> #include <vector> #include <string> #include "combo.h" #ifdef __LOCAL #include "grader.cpp" #endif // __LOCAL using namespace std; char extend(string &ans) { vector <char> options = {'A', 'B', 'X', 'Y'}; if(ans.size()!=0) options.erase(find(options.begin(), options.end(), ans[0])); if(ans.size()==0) { if(press("AB")>=1) { if(press("A")>=1) return 'A'; return 'B'; } else { if(press("X")>=1) return 'X'; return 'Y'; } } else { int res = press(ans+options[0]+ans+options[1]); if(res==ans.size()) return options[2]; res = press(ans+options[0]); if(res==ans.size()) return options[1]; return options[0]; } } string guess_sequence(int N) { string ans = ""; for(int i = 0;i<N;i++) ans += extend(ans); return ans; }

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

combo.cpp: In function 'char extend(std::string&)':
combo.cpp:35:15: 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(res==ans.size()) return options[2];
      |            ~~~^~~~~~~~~~~~
combo.cpp:38:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if(res==ans.size()) return options[1];
      |            ~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...