제출 #503736

#제출 시각아이디문제언어결과실행 시간메모리
503736sliviu콤보 (IOI18_combo)C++14
100 / 100
29 ms652 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s = "", left; char first; if (press("AB")) if (press("A")) s += (first = 'A'); else s += (first = 'B'); else if (press("X")) s += (first = 'X'); else s += (first = 'Y'); for (auto x : "ABXY") if (x != first) left += x; for (int i = 2; i <= N - 1; ++i) { string q = s + left[0] + left[0] + s + left[0] + left[1] + s + left[0] + left[2] + s + left[1]; int qry = press(q); if (qry == s.length() + 2) s += left[0]; else if (qry == s.length() + 1) s += left[1]; else s += left[2]; } if (N != 1) { if (press(s + left[0]) == N) s += left[0]; else if (press(s + left[1]) == N) s += left[1]; else s += left[2]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:11: 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 (qry == s.length() + 2)
      |       ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:27:16: 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 (qry == s.length() + 1)
      |            ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...