結果

問題 No.3185 Three Abs
ユーザー tails
提出日時 2025-06-20 22:03:14
言語 cLay
(20241019-1)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 2,702 ms
コンパイル使用メモリ 186,848 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2025-06-20 22:03:20
合計ジャッジ時間 5,466 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@t;
rep(t){
	ll@n,@a[n],b[n],c[n],s,t,z;
	b[0]=c[0]=s=a[0];
	rep(i,1,n){
		s+=a[i];
		b[i]=max(b[i-1],s);
		c[i]=min(c[i-1],s);
	}
	z=t=s;
	rrep(i,n){
		z>?=b[i]*2-s*2+t;
		z>?=-c[i]*2+s*2-t;
		s-=a[i];
	}
	wt(z);
}
0