제출 #199347

#제출 시각아이디문제언어결과실행 시간메모리
199347mythos콤보 (IOI18_combo)C++14
100 / 100
58 ms564 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string p = ""; if (press("AB") >= 1) p = press("A") ? "A" : "B"; else p = press("X") ? "X" : "Y"; vector<char> chr = {'A', 'B', 'X', 'Y'}; chr.erase(find(chr.begin(), chr.end(), p[0])); while ((int) p.size() <= N - 2) { int que = press(p + chr[0] + chr[0] + p + chr[0] + chr[1] + p + chr[1] + chr[0]); if (que == (int) p.size()) p.push_back(chr[2]); else if (que == p.size() + 1) { que = press(p + chr[1] + chr[2]); if (que == (int) p.size()) p = p + chr[0] + chr[2]; else if (que == (int) p.size() + 1) p = p + chr[1] + chr[1]; else p = p + chr[1] + chr[2]; } else { que = press(p + chr[0] + chr[1]); if (que == (int) p.size()) p = p + chr[1] + chr[0]; else if (que == (int) p.size() + 1) p = p + chr[0] + chr[0]; else p = p + chr[0] + chr[1]; } } while ((int) p.size() != N) { if (press(p + chr[0]) == (int) p.size() + 1) p.push_back(chr[0]); else if (press(p + chr[1]) == (int) p.size() + 1) p.push_back(chr[1]); else p.push_back(chr[2]); } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         else if (que == p.size() + 1) {
      |                  ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...