제출 #875048

#제출 시각아이디문제언어결과실행 시간메모리
875048amin_2008콤보 (IOI18_combo)C++17
100 / 100
13 ms1844 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define REP(i,n) for(int i=0;i<(n);++i) const int M = 4; const char LET[] = "ABXY"; int guess_one(const string& s) { int len = press(s + LET[0] + s + LET[1]); int idx = 2*(len < s.length()+1); len = press(s + LET[idx]); idx += (len < s.length()+1); return idx; } string guess_sequence(int N) { int idx[M]; REP(i, M) { idx[i] = i; } string s; { int id = guess_one(s); s += LET[id]; swap(idx[id], idx[M-1]); } REP(i, N-2) { string z; REP(j, M-1) { z += s + LET[idx[0]] + LET[idx[j]]; } z += s + LET[idx[1]]; int len = press(z); if (len == i+3) { s += LET[idx[0]]; } else if (len == i+2) { s += LET[idx[1]]; } else { s += LET[idx[2]]; } } if (N > 1) { int id = guess_one(s); s += LET[id]; } return s; }

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

combo.cpp: In function 'int guess_one(const string&)':
combo.cpp:11:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   int idx = 2*(len < s.length()+1);
      |                ~~~~^~~~~~~~~~~~~~
combo.cpp:13:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   idx += (len < s.length()+1);
      |           ~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...