結果

問題 No.1211 円環はお断り
ユーザー tailstails
提出日時 2020-08-30 17:55:55
言語 cLay
(20240104-1)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 160,176 KB
実行使用メモリ 8,536 KB
最終ジャッジ日時 2023-09-19 01:04:48
合計ジャッジ時間 6,124 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,456 KB
testcase_01 AC 2 ms
5,336 KB
testcase_02 AC 2 ms
5,468 KB
testcase_03 AC 2 ms
5,424 KB
testcase_04 AC 2 ms
5,332 KB
testcase_05 AC 2 ms
5,352 KB
testcase_06 AC 2 ms
5,472 KB
testcase_07 AC 2 ms
5,400 KB
testcase_08 AC 2 ms
5,328 KB
testcase_09 AC 2 ms
5,452 KB
testcase_10 AC 2 ms
5,440 KB
testcase_11 AC 2 ms
5,356 KB
testcase_12 AC 2 ms
5,364 KB
testcase_13 AC 57 ms
7,116 KB
testcase_14 AC 91 ms
7,552 KB
testcase_15 AC 82 ms
7,524 KB
testcase_16 AC 101 ms
8,424 KB
testcase_17 AC 12 ms
5,692 KB
testcase_18 AC 73 ms
7,372 KB
testcase_19 AC 10 ms
5,656 KB
testcase_20 AC 15 ms
5,712 KB
testcase_21 AC 13 ms
5,700 KB
testcase_22 AC 60 ms
7,188 KB
testcase_23 AC 67 ms
7,488 KB
testcase_24 AC 34 ms
6,572 KB
testcase_25 AC 4 ms
5,504 KB
testcase_26 AC 87 ms
7,704 KB
testcase_27 AC 35 ms
6,584 KB
testcase_28 AC 89 ms
7,900 KB
testcase_29 AC 62 ms
7,392 KB
testcase_30 AC 77 ms
7,800 KB
testcase_31 AC 35 ms
6,376 KB
testcase_32 AC 90 ms
8,152 KB
testcase_33 AC 93 ms
8,320 KB
testcase_34 AC 94 ms
8,348 KB
testcase_35 AC 94 ms
8,536 KB
testcase_36 AC 94 ms
8,376 KB
testcase_37 AC 94 ms
8,388 KB
testcase_38 AC 71 ms
8,332 KB
testcase_39 AC 72 ms
8,440 KB
testcase_40 AC 109 ms
6,828 KB
testcase_41 AC 2 ms
5,420 KB
testcase_42 AC 2 ms
5,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll n,k,a[1d5];
ll g,h,m;

ll j,s;
ll c[1d5],d[1d5],e[1d5];
bool f(ll m){
	j=s=0;
	rep(i,n){
		while(s<m){
			s+=a[j++%n];
			if(j-i>n){
				return false;
			}
		}
		c[i]=j;
		s-=a[i];
	}
	rrep(i,n){
		if(c[i]>=n){
			d[i]=1,e[i]=c[i]-n;
		}else{
			d[i]=1+d[c[i]],e[i]=e[c[i]];
		}
		if(d[i]==k && e[i]<=i){
			return true;
		}
	}
	return false;
}

{
	rd(n,k,a(n));
	g=1;
	h=1d14+1;
	while(g+1<h){
		m=g+h>>1;
		if(f(m)){
			g=m;
		}else{
			h=m;
		}
	}
	wt(g);
}
0