結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー tpynerivertpyneriver
提出日時 2020-07-04 19:47:07
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 93,328 KB
最終ジャッジ日時 2023-08-04 13:04:00
合計ジャッジ時間 5,762 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,480 KB
testcase_01 AC 68 ms
71,452 KB
testcase_02 AC 72 ms
71,356 KB
testcase_03 AC 69 ms
71,460 KB
testcase_04 AC 70 ms
71,256 KB
testcase_05 AC 68 ms
71,276 KB
testcase_06 AC 70 ms
71,124 KB
testcase_07 AC 70 ms
71,604 KB
testcase_08 AC 72 ms
71,380 KB
testcase_09 AC 69 ms
71,256 KB
testcase_10 AC 71 ms
71,264 KB
testcase_11 AC 70 ms
71,428 KB
testcase_12 AC 69 ms
71,416 KB
testcase_13 AC 69 ms
71,360 KB
testcase_14 AC 68 ms
71,436 KB
testcase_15 AC 70 ms
71,316 KB
testcase_16 AC 71 ms
71,520 KB
testcase_17 AC 71 ms
71,420 KB
testcase_18 AC 71 ms
71,420 KB
testcase_19 AC 72 ms
71,256 KB
testcase_20 AC 72 ms
71,276 KB
testcase_21 AC 71 ms
71,280 KB
testcase_22 AC 92 ms
90,396 KB
testcase_23 AC 91 ms
90,280 KB
testcase_24 AC 91 ms
88,688 KB
testcase_25 AC 91 ms
90,472 KB
testcase_26 AC 95 ms
92,800 KB
testcase_27 AC 96 ms
92,880 KB
testcase_28 AC 95 ms
93,328 KB
testcase_29 AC 91 ms
90,324 KB
testcase_30 AC 92 ms
90,632 KB
testcase_31 AC 91 ms
89,940 KB
testcase_32 AC 93 ms
90,764 KB
testcase_33 AC 95 ms
90,556 KB
testcase_34 AC 98 ms
92,920 KB
testcase_35 AC 97 ms
92,696 KB
testcase_36 AC 96 ms
93,264 KB
testcase_37 AC 94 ms
92,676 KB
testcase_38 AC 92 ms
90,652 KB
testcase_39 AC 91 ms
90,172 KB
testcase_40 AC 94 ms
91,316 KB
testcase_41 AC 94 ms
92,544 KB
testcase_42 AC 94 ms
91,820 KB
testcase_43 AC 93 ms
91,820 KB
testcase_44 AC 95 ms
92,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline

N = int(readline())

if N == 1:
    print(0)
else:
    s, t = map(int, readline().split())
    s -= 1
    t -= 1
    
    A = list(map(int, readline().split()))
    A = A[s:] + A[:s]
    t = (t-s)%N
    
    total = sum(A)
    X = A[0]
    C1 = A[1:t]
    C2 = A[N-1:t:-1]
    l1 = len(C1)
    l2 = len(C2)
    
    if l1 & 1 and l2 & 1:
        X += max(sum(C1[:l1//2])+sum(C2[:1+l2//2]), sum(C1[:1+l1//2])+sum(C2[:l2//2])) 
    else:
        X += sum(C1[:(l1+1)//2]) + sum(C2[:(l2+1)//2])
    ans = 2*X - total
    print(ans)
0