제출 #162751

#제출 시각아이디문제언어결과실행 시간메모리
162751Minnakhmetov콤보 (IOI18_combo)C++14
5 / 100
3 ms272 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define all(aaa) aaa.begin(), aaa.end() void guess_one_letter(string &s, string t) { int l = -1, r = t.size() - 1; while (r - l > 1) { int p = (l + r) >> 1; string g; for (int i = 0; i <= p; i++) { g += s + string(1, t[i]); } if (press(g) >= s.size() + 1) r = p; else l = p; } s.push_back(t[r]); } string guess_sequence(int n) { string s, t = "AXYB"; guess_one_letter(s, t); t.erase(find(all(t), s[0])); for (int i = 2; i < n; i++) { string p = s + string(1, t[0]) + s + string(1, t[1]) + string(1, t[0]) + s + string(1, t[1]) + string(1, t[1]) + s + string(1, t[1]) + string(1, t[2]); int coins = press(p); if (coins == i) s.push_back(t[0]); else if (coins == i + 1) s.push_back(t[1]); else s.push_back(t[2]); } guess_one_letter(s, t); return s; }

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

combo.cpp: In function 'void guess_one_letter(std::string&, std::string)':
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 |         if (press(g) >= s.size() + 1)
      |             ~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...