제출 #777841

#제출 시각아이디문제언어결과실행 시간메모리
777841JoenPoenMan콤보 (IOI18_combo)C++17
10 / 100
58 ms444 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char chars[4] = {'X', 'Y', 'A', 'B'}; std::string guess_sequence(int N) { string S{}; char first; for (char ch : chars) { if (press(S + ch)) { S += ch; first = ch; break; } } for (int i = 1; i < N; i++) { for (char ch : chars) if (ch != first) { if (press(S + ch) == S.length()+1) { S += ch; break; } } } return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |             if (press(S + ch) == S.length()+1) {
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:19:31: warning: 'first' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |         for (char ch : chars) if (ch != first) {
      |                               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...