結果
問題 |
No.3281 Pacific White-sided Dolphin vs Monster
|
ユーザー |
|
提出日時 | 2025-09-26 23:14:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 753 bytes |
コンパイル時間 | 2,040 ms |
コンパイル使用メモリ | 204,240 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-26 23:15:04 |
合計ジャッジ時間 | 4,749 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<ll> a(n); for(auto &&v : a) cin >> v; sort(a.rbegin(), a.rend()); ll p = 1; int ng = -1, ok = 60; while(ng + 1 < ok){ int mid = (ng + ok) / 2; int cur = n + mid - 1; int idx = max(0, cur - 59); priority_queue<ll> pq; for(int i = idx; i < n; i++) pq.emplace(a[i]); for(int i = min(cur, 59); i >= 0 && !pq.empty(); i--){ ll v = pq.top(); pq.pop(); v -= 1ll << i; if(v > 0) pq.emplace(v); } (pq.empty() ? ok : ng) = mid; } cout << n + ok << '\n'; }