제출 #788523

#제출 시각아이디문제언어결과실행 시간메모리
788523aykhnCombo (IOI18_combo)C++14
10 / 100
36 ms452 KiB
#include <bits/stdc++.h> #include "combo.h" // author: aykhn using namespace std; typedef long long ll; #define TC int t; cin >> t; while (t--) _(); #define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define all(v) v.begin(), v.end() #define pii pair<int, int> #define mpr make_pair #define eb emplace_back #define new int32_t #define pb push_back #define ts to_string #define fi first #define se second //#define int ll #define ins insert #define inf 0x3F3F3F3F #define infll 0x3F3F3F3F3F3F3F3FLL #define bpc __builtin_popcount string guess_sequence(int n) { string ans = ""; char ch[4] = {'A', 'B', 'X', 'Y'}; while (ans.length() != n) { int s = ans.length(); for (int i = 0; i < 4; i++) { string nw = ans; if (!ans.empty() && ch[i] == ans.back()) continue; for (int j = ans.length() + 1; j <= n; j++) { nw.pb(ch[i]); } int ns = press(nw); if (ns > s) { for (int j = 1; j <= ns - s; j++) { ans.pb(ch[i]); } break; } } } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |     while (ans.length() != n)
      |            ~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...