結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2018-11-02 01:08:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 339 ms / 5,000 ms |
コード長 | 1,067 bytes |
コンパイル時間 | 1,824 ms |
コンパイル使用メモリ | 204,516 KB |
最終ジャッジ日時 | 2025-01-06 15:22:03 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; using i64 = int64_t; using vi = vector<i64>; using vvi = vector<vi>; int main() { // assert(freopen("/Users/xuzijian/yukicoder/input4", "r", stdin)); int n; cin >> n; using ii = pair<int, int>; priority_queue<ii, vector<ii>, greater<ii>> que; for (int i = 0; i < n; i++) { int a; cin >> a; que.push(ii(a, 0)); } deque<int> bs; for (int i = 0; i < n; i++) { int b; cin >> b; bs.push_back(b); } int ans = 1e9; for (int i = 0; i < n; i++) { priority_queue<ii, vector<ii>, greater<ii>> q(que); for (int j = 0; j < n; j++) { ii m = q.top(); q.pop(); m.first += bs[j] / 2; m.second++; q.push(m); } int tmp = -1; while (q.size()) { tmp = max(tmp, q.top().second); q.pop(); } ans = min(ans, tmp); bs.push_back(bs.front()); bs.pop_front(); } cout << ans << endl; }