제출 #401532

#제출 시각아이디문제언어결과실행 시간메모리
401532_DaNeK_콤보 (IOI18_combo)C++17
30 / 100
49 ms448 KiB
#include <bits/stdc++.h> using namespace std; char m[4] = {'A', 'B', 'Y', 'X'}; int press(string p); string guess_sequence(int N) { string res = ""; int cur = 0, i = 0, first = 0; while (i < 3 && press(res + m[i]) != cur + 1) ++i; res += m[i]; first = i; cur = 2; while (res.size() < N) { int ind = 0, cnt = 0; bool f = true; while (cnt < 2 && f) { if (ind == first) { ++ind; continue ; } if (press(res + m[ind]) == cur) f = false; if (f) { ++cnt; ++ind; } } if (ind == first) ++ind; ++cur; res += m[ind]; } return res; }

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

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