제출 #430719

#제출 시각아이디문제언어결과실행 시간메모리
430719albertolg101콤보 (IOI18_combo)C++17
100 / 100
37 ms620 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; using ll = long long; string f (string s, string &d) { string ans; return ans; } string guess_sequence(int N) { string ans, d; int r = press("AB"); if(r) { r = press("A"); ans = (r ? "A" : "B"); d = "XY"; d += (r ? "B" : "A"); } else { r = press("X"); ans = (r ? "X" : "Y"); d = "AB"; d += (r ? "Y" : "X"); } for(int i = 1 ; i < N - 1 ; i++) { string q = ans + d[0] + d[1] + ans + d[0] + d[2] + ans + d[0] + d[0] + ans + d[1]; r = press(q); if(r == ans.size()) ans += d[2]; else if(r == ans.size() + 1) ans += d[1]; else ans += d[0]; } if(N > 1) { int r1 = press(ans + d[0]), r2 = press(ans + d[1]); if(r1 > r2) ans += d[0]; else if(r1 < r2) ans += d[1]; else ans += d[2]; } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |   if(r == ans.size())
      |      ~~^~~~~~~~~~~~~
combo.cpp:46:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |   else if(r == ans.size() + 1)
      |           ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...