제출 #87149

#제출 시각아이디문제언어결과실행 시간메모리
87149AlexPop28콤보 (IOI18_combo)C++11
100 / 100
51 ms560 KiB
#include <bits/stdc++.h> #define all(cont) cont.begin(), cont.end() #define pb push_back #define fi first #define se second #define DEBUG(x) cerr << (#x) << ": " << (x) << '\n' #include "combo.h" using namespace std; typedef pair <int, int> pii; typedef vector <int> vi; typedef long long ll; typedef unsigned long long ull; string guess_sequence (int N) { string p = "", cand = "", s; int aux; p = press ("AB") ? (press ("A") ? "A" : "B") : (press ("X") ? "X" : "Y"); for (char c : "ABXY") { if (c == p[0]) continue; cand += c; } if (p.size() == N) return p; for (int i = 2; i <= N - 1; ++i) { s = p + cand[0] + p + cand[1] + cand[0] + p + cand[1] + cand[1] + p + cand[1] + cand[2]; aux = press (s); if (aux == i - 1) { p += cand[2]; } else if (aux == i) { p += cand[0]; } else { p += cand[1]; } } for (int i = 0; i < 2; ++i) { aux = press (p + cand[i]); if (aux == N) return (p + cand[i]); } return (p + cand[2]); }

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

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