結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー 37zigen37zigen
提出日時 2020-08-08 01:54:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 11,848 KB
実行使用メモリ 20,888 KB
最終ジャッジ日時 2023-10-25 08:58:55
合計ジャッジ時間 5,132 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,160 KB
testcase_01 AC 30 ms
10,160 KB
testcase_02 AC 30 ms
10,160 KB
testcase_03 AC 30 ms
10,160 KB
testcase_04 AC 30 ms
10,160 KB
testcase_05 AC 30 ms
10,160 KB
testcase_06 WA -
testcase_07 AC 30 ms
10,160 KB
testcase_08 AC 29 ms
10,160 KB
testcase_09 AC 30 ms
10,160 KB
testcase_10 AC 30 ms
10,160 KB
testcase_11 AC 30 ms
10,160 KB
testcase_12 AC 30 ms
10,160 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 31 ms
10,160 KB
testcase_16 AC 30 ms
10,160 KB
testcase_17 AC 30 ms
10,164 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 104 ms
19,360 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 99 ms
19,412 KB
testcase_26 AC 113 ms
20,180 KB
testcase_27 AC 106 ms
20,572 KB
testcase_28 AC 111 ms
20,840 KB
testcase_29 AC 100 ms
19,128 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 107 ms
19,312 KB
testcase_33 WA -
testcase_34 AC 106 ms
20,188 KB
testcase_35 AC 114 ms
20,560 KB
testcase_36 AC 116 ms
20,740 KB
testcase_37 WA -
testcase_38 AC 98 ms
19,176 KB
testcase_39 AC 101 ms
19,196 KB
testcase_40 AC 105 ms
19,864 KB
testcase_41 WA -
testcase_42 AC 106 ms
16,960 KB
testcase_43 AC 107 ms
16,960 KB
testcase_44 AC 118 ms
20,888 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
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