제출 #127006

#제출 시각아이디문제언어결과실행 시간메모리
127006kingfran1907콤보 (IOI18_combo)C++14
0 / 100
3 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; const char koj[] = "ABXY"; string guess_sequence(int n) { string s; char ac = 'Z'; for (int i = 0; i < 3; i++) { string tren; tren += koj[i]; if (press(tren) == 1) ac = koj[i]; } if (ac == 'Z') ac = 'Y'; char a = 0, b = 0, c = 0; for (int i = 0; i < 4; i++) { if (koj[i] == ac) continue; if (a == 0) a = koj[i]; else if (b == 0) b = koj[i]; else c = koj[i]; } assert(a > 0 && b > 0 && c > 0); s += ac; for (int i = 1; i < n - 1; i++) { string query = s + a + s + b + c + s + b + b; int kol = press(query); if (kol == s.size()) s.push_back(c); else if (kol == s.size() + 1) s.push_back(a); else s.push_back(b); }; for (int i = 0; i < 4; i++) { if (koj[i] == ac) continue; string query = s + koj[i]; if (press(query) == n) { s += koj[i]; break; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 if (kol == s.size()) s.push_back(c);
      |                     ~~~~^~~~~~~~~~~
combo.cpp:33:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |                 else if (kol == s.size() + 1) s.push_back(a);
      |                          ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...