結果

問題 No.3281 Pacific White-sided Dolphin vs Monster
ユーザー Facade
提出日時 2025-10-11 09:18:20
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 977 bytes
コンパイル時間 3,017 ms
コンパイル使用メモリ 281,988 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-11 09:18:26
合計ジャッジ時間 5,681 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int inf=1e18;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a.begin(),a.end());
    int p=1;
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]%2==1){
            a[i]-=1;
            ans++;
            p*=2;
            break;
        }
    }
    auto pw=[&](int bt,int id)->int {
        int pww=bt;
        int ret=1;
        for(int i=0;i<10;i++){
            if(id&1){
                ret*=pww;
            }
            pww*=pww;
            id=id>>1;
        }
        return ret;
    };
    for(int i=0;i<n;i++){
        int lw=a[i];
        int ad=pw(2,ans);
        lw+=ad;
        int ok=64-ans,ng=-1;
        while(ok-ng>1){
            int c=(ok+ng)/2;
            if(pw(2,ans+c)>=lw)ok=c;
            else ng=c;
        }
        ans+=ok;
        
    }
    cout<<ans<<endl;
}
0