제출 #241864

#제출 시각아이디문제언어결과실행 시간메모리
241864syy콤보 (IOI18_combo)C++17
100 / 100
39 ms668 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++) #define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--) typedef pair<int, int> pi; typedef pair<int, pi> pii; typedef pair<pi, pi> pipi; #define f first #define s second typedef vector<int> vi; typedef vector<pi> vpi; typedef vector<pii> vpii; #define pb push_back #define pf push_front #define all(v) v.begin(), v.end() #define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin()); #define INF (int) 1e9 + 100 #define LLINF (ll) 1e18 #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) string s; vector<string> str; string guess_sequence(int n) { if (press("AB")) { if (press("A")) s = "A"; else s = "B"; } else { if (press("X")) s = "X"; else s = "Y"; } if (s == "A") str = {"B", "XB", "XX", "XY"}; else if (s == "B") str = {"A", "XA", "XX", "XY"}; else if (s == "X") str = {"A", "BA", "BB", "BY"}; else str = {"A", "BA", "BB", "BX"}; FOR(i, 1, n-2) { int res = press(s + str[0] + s + str[1] + s + str[2] + s + str[3]); if (res == s.length()) s += str[3][1]; else if (res == s.length() + 1) s += str[0]; else s += str[1][0]; } if (n >= 2) { if (press(s + "A" + s + "B") > s.length()) { if (press(s + "A") > s.length()) s += "A"; else s += "B"; } else { if (press(s + "X") > s.length()) s += "X"; else s += "Y"; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:41:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   if (res == s.length()) s += str[3][1];
      |       ~~~~^~~~~~~~~~~~~
combo.cpp:42:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |   else if (res == s.length() + 1) s += str[0];
      |            ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:46:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |   if (press(s + "A" + s + "B") > s.length()) {
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:47:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |    if (press(s + "A") > s.length()) s += "A";
      |        ~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |    if (press(s + "X") > s.length()) s += "X";
      |        ~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...