結果

問題 No.1211 円環はお断り
ユーザー RhoRho
提出日時 2020-08-24 22:23:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 890 bytes
コンパイル時間 1,436 ms
コンパイル使用メモリ 164,268 KB
実行使用メモリ 21,632 KB
最終ジャッジ日時 2024-04-24 03:56:41
合計ジャッジ時間 8,703 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 33 ms
6,784 KB
testcase_18 WA -
testcase_19 AC 34 ms
6,784 KB
testcase_20 AC 45 ms
7,680 KB
testcase_21 AC 42 ms
7,680 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 133 ms
15,744 KB
testcase_25 AC 9 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 137 ms
16,000 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 121 ms
14,208 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 289 ms
21,624 KB
testcase_39 AC 287 ms
21,496 KB
testcase_40 AC 410 ms
21,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using namespace std;
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<ll,ll>P;
#define vi vector<ll>
const ll inf=1ll<<61;
ll a[100006];
ll rwa[200005];
ll to[20][100005];
signed main(){
	ll n,k;cin>>n>>k;
	ll S=0;
	rep(i,n){
		cin>>a[i];
		rwa[i+1]=rwa[i+n+1]=a[i];
		S+=a[i];
	}
	rep(i,n+n)rwa[i+1]+=rwa[i];

	ll lb=0,ub=(S/k)+1;
	while(ub-lb>1){
		//全員がmi以上保持できるか?
		ll mi=(ub+lb)/2;

		rep(i,n){
			auto itr=lower_bound(rwa,rwa+n+n+1,rwa[i]+mi);
			to[0][i]=itr-rwa;
			to[0][i+n]=to[0][i]+n;
			if(to[0][i+n]>=n+n)to[0][i+n]=n+n;
		}
		rep(i,19){
			rep(j,n+n){
				to[i+1][j]=to[i][to[i][j]];
			}
		}
		int ok=0;
		rep(i,n){
			int now=i;
			rep(j,19){
				if(k&(1<<j))now=to[j][now];
			}
			if(i<now&&now<=i+n)ok++;
		}

		if(ok)lb=mi;
		else ub=mi;
	}
	cout<<lb<<endl;
}
0