結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2020-09-03 08:19:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 274 ms / 5,000 ms |
コード長 | 784 bytes |
コンパイル時間 | 1,938 ms |
コンパイル使用メモリ | 176,312 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 18:44:23 |
合計ジャッジ時間 | 4,580 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) #define chmax(a, b) a = max(a, b) #define chmin(a, b) a = min(a, b) #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; using P = pair<int,int>; using VI = vector<int>; using VVI = vector<VI>; int main() { int n; cin >> n; VI a(n), b(n); rep(i, n) cin >> a[i]; rep(i, n) cin >> b[i]; int ans = n; rep(s, n) { priority_queue<P,vector<P>,greater<P>> q; rep(i, n) q.emplace(a[i],0); int mx = 0; rep(j, n) { int ai, ci; tie(ai, ci) = q.top(); q.pop(); q.emplace(ai + b[(s+j)%n] / 2, ci + 1); chmax(mx, ci + 1); } chmin(ans, mx); } cout << ans << endl; }