結果

問題 No.2217 Suffix+
ユーザー hiro71687khiro71687k
提出日時 2023-02-24 18:54:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 1,015 bytes
コンパイル時間 4,281 ms
コンパイル使用メモリ 260,960 KB
実行使用メモリ 4,792 KB
最終ジャッジ日時 2023-10-11 03:52:59
合計ジャッジ時間 9,499 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,356 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 13 ms
4,352 KB
testcase_15 AC 13 ms
4,352 KB
testcase_16 AC 24 ms
4,352 KB
testcase_17 AC 18 ms
4,348 KB
testcase_18 AC 15 ms
4,348 KB
testcase_19 AC 51 ms
4,436 KB
testcase_20 AC 50 ms
4,348 KB
testcase_21 AC 10 ms
4,348 KB
testcase_22 AC 52 ms
4,352 KB
testcase_23 AC 41 ms
4,348 KB
testcase_24 AC 59 ms
4,612 KB
testcase_25 AC 59 ms
4,704 KB
testcase_26 AC 59 ms
4,780 KB
testcase_27 AC 59 ms
4,660 KB
testcase_28 AC 59 ms
4,676 KB
testcase_29 AC 113 ms
4,708 KB
testcase_30 AC 113 ms
4,676 KB
testcase_31 AC 114 ms
4,696 KB
testcase_32 AC 113 ms
4,656 KB
testcase_33 AC 115 ms
4,792 KB
testcase_34 AC 62 ms
4,676 KB
testcase_35 AC 1 ms
4,372 KB
testcase_36 AC 129 ms
4,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=double;
ld pie=3.14159265359;
ll mod=998244353;
ll inf=10000000000000000;
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll left=0,right=inf;
    while (right-left>1)
    {
        ll mid=(right+left)/2;
        vector<ll>b=a;
        ll now=0;
        ll nec=0;
        for (ll i = 0; i < n; i++)
        {
            if (a[i]+now<mid)
            {
                ll y=0;
                y+=(mid-now-a[i])/(i+1);
                if ((mid-now-a[i])%(i+1)!=0)
                {
                    y+=1;
                }
                nec+=y;
                now+=y*(i+1);
            }
            if (nec>k)
            {
                break;
            }
        }
        if (nec>k)
        {
            right=mid;
        }else{
            left=mid;
        }
    }
    cout << left << endl;
}
0