結果
| 問題 |
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
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 753 bytes |
| コンパイル時間 | 1,880 ms |
| コンパイル使用メモリ | 204,244 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-10-03 17:37:33 |
| 合計ジャッジ時間 | 3,984 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
#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';
}