結果
問題 | No.1150 シュークリームゲーム(Easy) |
ユーザー |
|
提出日時 | 2023-02-14 20:32:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 98 ms / 2,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 82,220 KB |
実行使用メモリ | 110,976 KB |
最終ジャッジ日時 | 2024-07-17 08:42:32 |
合計ジャッジ時間 | 6,129 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 43 |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N = int(input()) s,t = map(int,input().split()) A = list(map(int,input().split())) SUM = sum(A) X = A+A+A SS = list(accumulate([0]+X)) ans = 0 M = (N+1)//2 if s<t: s += N s -= 1 t -= 1 I = (s+t+1)//2 T = t+N J = (T+s)//2 while I+M<=J+1: ans = max(ans,SS[I+M] - SS[I]) I += 1 print(2*ans-SUM)