結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー 37zigen37zigen
提出日時 2020-08-08 02:05:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 11,820 KB
実行使用メモリ 20,844 KB
最終ジャッジ日時 2023-10-25 09:13:26
合計ジャッジ時間 5,536 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,116 KB
testcase_01 AC 30 ms
10,116 KB
testcase_02 AC 29 ms
10,116 KB
testcase_03 AC 30 ms
10,116 KB
testcase_04 AC 29 ms
10,116 KB
testcase_05 AC 30 ms
10,116 KB
testcase_06 AC 30 ms
10,116 KB
testcase_07 AC 29 ms
10,116 KB
testcase_08 AC 30 ms
10,116 KB
testcase_09 AC 30 ms
10,116 KB
testcase_10 AC 30 ms
10,116 KB
testcase_11 AC 31 ms
10,116 KB
testcase_12 AC 31 ms
10,116 KB
testcase_13 AC 30 ms
10,116 KB
testcase_14 AC 30 ms
10,116 KB
testcase_15 AC 30 ms
10,116 KB
testcase_16 AC 30 ms
10,116 KB
testcase_17 AC 30 ms
10,120 KB
testcase_18 AC 30 ms
10,120 KB
testcase_19 AC 29 ms
10,120 KB
testcase_20 AC 30 ms
10,120 KB
testcase_21 AC 30 ms
10,120 KB
testcase_22 AC 102 ms
19,316 KB
testcase_23 AC 100 ms
19,660 KB
testcase_24 AC 92 ms
19,064 KB
testcase_25 AC 98 ms
19,368 KB
testcase_26 AC 111 ms
20,136 KB
testcase_27 AC 108 ms
20,532 KB
testcase_28 AC 112 ms
20,796 KB
testcase_29 AC 101 ms
19,084 KB
testcase_30 AC 103 ms
19,852 KB
testcase_31 AC 101 ms
19,384 KB
testcase_32 AC 106 ms
19,268 KB
testcase_33 AC 105 ms
19,884 KB
testcase_34 AC 108 ms
20,148 KB
testcase_35 AC 114 ms
20,516 KB
testcase_36 AC 116 ms
20,696 KB
testcase_37 AC 114 ms
20,792 KB
testcase_38 AC 99 ms
19,132 KB
testcase_39 AC 102 ms
19,152 KB
testcase_40 AC 104 ms
19,820 KB
testcase_41 AC 108 ms
20,572 KB
testcase_42 AC 103 ms
16,920 KB
testcase_43 AC 106 ms
16,920 KB
testcase_44 AC 117 ms
20,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
s,t=map(int,input().split())
A=[int(x) for x in input().split()]
B=[A[(i+s-1)%N] for i in range(N)]
s,t=0,(t-s)%N
a,b=t-s-1,N-t-1
ans=2*B[0]-sum(B)
u,v=0,0
while 2*(u+v)<N-2:
    if 2*(u+1)<=a:
        ans+=2*B[1+u]
        u+=1
    elif 2*(v+1)<=b:
        ans+=2*B[N-1-v]
        v+=1
    else:
        add=0
        if 2*u<a:
            add=max(add,B[1+u])
            u+=1
        if 2*v<b:
            add=max(add,B[N-1-v])
            v+=1
        ans+=2*add
print(ans)
0