結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー furafura
提出日時 2020-08-07 21:56:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 2,681 ms
コンパイル使用メモリ 204,204 KB
実行使用メモリ 5,708 KB
最終ジャッジ日時 2023-10-25 00:55:48
合計ジャッジ時間 4,387 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 2 ms
4,372 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,372 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,372 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 15 ms
5,708 KB
testcase_44 AC 17 ms
5,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

const long long INF=1LL<<61;

int main(){
	int n,s,t; scanf("%d%d%d",&n,&s,&t); s--; t--;
	vector<int> a(2*n);
	rep(i,n) scanf("%d",&a[i]), a[n+i]=a[i];

	vector<lint> cum(2*n+1);
	rep(i,2*n) cum[i+1]=cum[i]+a[i];

	lint ans=-INF;
	rep(l,n){
		int r=l+(n+1)/2;
		if((l<=s && s<r) || (l<=s+n && s+n<r)){
			if(!(l<=t && t<r) && !(l<=t+n && t+n<r)){
				ans=max(ans,2*(cum[r]-cum[l])-cum[n]);
			}
		}
	}
	printf("%lld\n",ans);

	return 0;
}
0