結果

問題 No.3758 Fan Meeting
コンテスト
ユーザー simasima_71
提出日時 2026-10-09 21:33:32
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,386 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,526 ms
コンパイル使用メモリ 252,600 KB
実行使用メモリ 9,920 KB
最終ジャッジ日時 2026-10-09 21:34:06
合計ジャッジ時間 5,751 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pl = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
template<class T> using pq_ = priority_queue<T, vector<T>, greater<T>>;
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
using mint=modint998244353;
// g++ a.cpp -std=c++23 -I.
// g++ -std=c++23 -I. a.cpp -o main
// g++ -std=c++23 -I. anaive.cpp -o naive
// g++ -std=c++23 -I. agene.cpp -o gene



int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin>>n;
    ll s;
    cin>>s;
    vl z(n);
    rep(i,0,n)cin>>z[i];
    sort(all(z));
    if(z[n-1]>=s){
        cout<<z[n-1]<<endl;
        return 0;
    }
    ll ok=z[n-1];
    ll ng=0;
    reverse(all(z));
    while(ok-ng>1){
        ll mid=(ok+ng)/2;
        ll nows=s;
        ll nd=0;
        ll e=0;
        rep(i,0,n){
            if(nd==0){
                if(nows<=z[i])e=1;
                else nows-=z[i];
                nd+=mid;
            }
            nd--;
        }
        if(e==0)ok=mid;
        else ng=mid;
    }
    cout<<ok<<endl;
}
0