結果

問題 No.2217 Suffix+
ユーザー QAQzaQAQza
提出日時 2023-03-08 12:19:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 32,296 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 05:54:16
合計ジャッジ時間 3,753 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 7 ms
4,348 KB
testcase_15 AC 6 ms
4,348 KB
testcase_16 AC 12 ms
4,348 KB
testcase_17 AC 9 ms
4,348 KB
testcase_18 AC 7 ms
4,348 KB
testcase_19 AC 49 ms
4,348 KB
testcase_20 AC 47 ms
4,348 KB
testcase_21 AC 12 ms
4,348 KB
testcase_22 AC 49 ms
4,348 KB
testcase_23 AC 44 ms
4,348 KB
testcase_24 AC 23 ms
4,348 KB
testcase_25 AC 23 ms
4,348 KB
testcase_26 AC 23 ms
4,348 KB
testcase_27 AC 24 ms
4,348 KB
testcase_28 AC 24 ms
4,348 KB
testcase_29 AC 75 ms
4,348 KB
testcase_30 AC 75 ms
4,348 KB
testcase_31 AC 74 ms
4,348 KB
testcase_32 AC 74 ms
4,348 KB
testcase_33 AC 75 ms
4,348 KB
testcase_34 AC 24 ms
4,348 KB
testcase_35 AC 1 ms
4,348 KB
testcase_36 AC 100 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#define MAXN 100005
long long a[MAXN];
int main() {
	int n,k;
	long long l,r,mid,s,tot;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
	l=0; r=1e14+k;
	while(l<=r) {
		mid=(l+r)>>1;
		s=0ll; tot=0ll;
		for(int i=1;i<=n;++i) {
			if(a[i]+s>=mid) continue;
			tot+=(mid-a[i]-s-1)/i+1;
			s+=((mid-a[i]-s-1)/i+1)*i;
		}
		if(tot<=k) l=mid+1;
		else r=mid-1;
	}
	printf("%lld",l-1);
	return 0;
} 
0