結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー tpynerivertpyneriver
提出日時 2020-07-04 19:47:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 86,008 KB
最終ジャッジ日時 2024-04-22 10:41:48
合計ジャッジ時間 4,088 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,692 KB
testcase_01 AC 42 ms
52,808 KB
testcase_02 AC 39 ms
52,368 KB
testcase_03 AC 38 ms
52,588 KB
testcase_04 AC 38 ms
51,936 KB
testcase_05 AC 38 ms
51,952 KB
testcase_06 AC 48 ms
52,748 KB
testcase_07 AC 38 ms
52,460 KB
testcase_08 AC 38 ms
53,372 KB
testcase_09 AC 38 ms
52,240 KB
testcase_10 AC 38 ms
52,144 KB
testcase_11 AC 38 ms
52,680 KB
testcase_12 AC 39 ms
53,528 KB
testcase_13 AC 40 ms
52,300 KB
testcase_14 AC 40 ms
52,484 KB
testcase_15 AC 40 ms
53,240 KB
testcase_16 AC 40 ms
52,284 KB
testcase_17 AC 39 ms
52,572 KB
testcase_18 AC 40 ms
53,080 KB
testcase_19 AC 40 ms
52,400 KB
testcase_20 AC 39 ms
52,000 KB
testcase_21 AC 40 ms
52,976 KB
testcase_22 AC 64 ms
82,220 KB
testcase_23 AC 62 ms
80,736 KB
testcase_24 AC 62 ms
79,636 KB
testcase_25 AC 64 ms
82,308 KB
testcase_26 AC 80 ms
84,788 KB
testcase_27 AC 68 ms
85,752 KB
testcase_28 AC 66 ms
86,008 KB
testcase_29 AC 63 ms
81,324 KB
testcase_30 AC 65 ms
82,544 KB
testcase_31 AC 63 ms
82,440 KB
testcase_32 AC 65 ms
81,692 KB
testcase_33 AC 64 ms
82,956 KB
testcase_34 AC 66 ms
84,660 KB
testcase_35 AC 67 ms
85,000 KB
testcase_36 AC 67 ms
85,740 KB
testcase_37 AC 68 ms
83,924 KB
testcase_38 AC 63 ms
81,976 KB
testcase_39 AC 64 ms
81,464 KB
testcase_40 AC 64 ms
82,692 KB
testcase_41 AC 67 ms
84,120 KB
testcase_42 AC 71 ms
82,788 KB
testcase_43 AC 71 ms
83,688 KB
testcase_44 AC 67 ms
85,004 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