제출 #277033

#제출 시각아이디문제언어결과실행 시간메모리
277033hamerin콤보 (IOI18_combo)C++17
100 / 100
41 ms656 KiB
#include "combo.h" #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") using namespace std; using i64 = long long; using d64 = long double; using pi = pair<int, int>; using pli = pair<i64, i64>; using ti = tuple<int, int, int>; using tli = tuple<i64, i64, i64>; #define iterall(cont) cont.begin(), cont.end() #define prec(n) setprecision(n) << fixed int N; string guess_sequence(int n) { N = n; string S; if (press("AB")) { if (press("A")) S += 'A'; else S += 'B'; } else { if (press("X")) S += 'X'; else S += 'Y'; } set<char> st = {'A', 'B', 'X', 'Y'}; st.erase(S[0]); vector<char> vc; copy(iterall(st), back_inserter(vc)); while (S.size() < N - 1) { auto x = press(S + vc[0] + vc[1] + S + vc[0] + vc[2] + S + vc[0] + vc[0] + S + vc[1]) - S.size(); if (x == 2) S += vc[0]; else if (x == 1) S += vc[1]; else S += vc[2]; } if (S.size() < N) { if (press(S + vc[0] + S + vc[1]) - S.size()) { if (press(S + vc[0]) - S.size()) S += vc[0]; else S += vc[1]; } else { S += vc[2]; } } return S; }

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

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