제출 #425344

#제출 시각아이디문제언어결과실행 시간메모리
425344dariasc콤보 (IOI18_combo)C++14
30 / 100
64 ms548 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char chars[] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N) { string S = "Y"; for (int i = 0; i < 3; i++) { if (press(string(1, chars[i])) == 1) { S = string(1, chars[i]); break; } } while (S.size() < N) { int asked = 0; for (int i = 0; i < 4; i++) { char btn = chars[i]; if (btn != S[0]) { // we don't need to ask 3 times if (asked == 2) { S += btn; break; } string cpy = S; cpy += btn; if (press(cpy) > S.size()) { S += btn; break; } asked++; } } } return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |   while (S.size() < N) {
      |          ~~~~~~~~~^~~
combo.cpp:29:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if (press(cpy) > S.size()) {
      |             ~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...