結果

問題 No.2217 Suffix+
ユーザー soragsorag
提出日時 2023-02-18 16:35:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 3,747 ms
コンパイル使用メモリ 226,272 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-27 08:09:11
合計ジャッジ時間 7,010 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 12 ms
4,380 KB
testcase_15 AC 12 ms
4,380 KB
testcase_16 AC 23 ms
4,376 KB
testcase_17 AC 17 ms
4,380 KB
testcase_18 AC 14 ms
4,380 KB
testcase_19 AC 56 ms
4,380 KB
testcase_20 AC 52 ms
4,376 KB
testcase_21 AC 11 ms
4,380 KB
testcase_22 AC 54 ms
4,376 KB
testcase_23 AC 47 ms
4,380 KB
testcase_24 AC 57 ms
4,380 KB
testcase_25 AC 57 ms
4,376 KB
testcase_26 AC 57 ms
4,376 KB
testcase_27 AC 57 ms
4,380 KB
testcase_28 AC 57 ms
4,376 KB
testcase_29 AC 112 ms
4,376 KB
testcase_30 AC 112 ms
4,376 KB
testcase_31 AC 110 ms
4,376 KB
testcase_32 AC 112 ms
4,380 KB
testcase_33 AC 112 ms
4,380 KB
testcase_34 AC 60 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 138 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#include <vector>
#include <set>
#include <queue>
#include <utility>
#include <map>
#include <regex>
#include <math.h>
#include <random>
#include <algorithm>
#define pb push_back
#define all(x) begin(x), end(x)
#define gall(x) begin(x), end(x), greater<>()
#define ll long long
#define rep(i,x) for(int i=0;i<x;i++)
#define P pair<int, int>
#define lP pair<ll, ll>
using namespace std;
using namespace atcoder;
using mint=modint998244353;

const int INF=1e9;

int main()
{ 
   ll n,K; cin>>n>>K;
   vector<ll> a(n+1);
   for(int i=1;i<=n;i++) cin>>a[i];
   ll ok=-1,ng=a[1]+K+5;
   while(ng-ok>1){
    ll k=K;
    ll mid=(ok+ng)/2;
    ll s=0;
   for(ll i=1;i<=n;i++){
    ll ai=a[i]+s;
    if(ai<mid){
        ll cnt=(mid-ai+i-1)/i;
        k-=cnt;
        s+=cnt*i;
    }
   }
   if(k>=0) ok=mid;
   else ng=mid;
   }
   cout<<ok<<endl;

return  0;
}
0