結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,128 KB
testcase_01 AC 29 ms
10,128 KB
testcase_02 AC 30 ms
10,128 KB
testcase_03 AC 29 ms
10,128 KB
testcase_04 AC 30 ms
10,128 KB
testcase_05 AC 29 ms
10,128 KB
testcase_06 AC 29 ms
10,128 KB
testcase_07 AC 29 ms
10,128 KB
testcase_08 AC 29 ms
10,128 KB
testcase_09 AC 30 ms
10,128 KB
testcase_10 AC 30 ms
10,128 KB
testcase_11 AC 30 ms
10,128 KB
testcase_12 AC 29 ms
10,128 KB
testcase_13 AC 30 ms
10,128 KB
testcase_14 AC 30 ms
10,128 KB
testcase_15 AC 30 ms
10,128 KB
testcase_16 AC 29 ms
10,128 KB
testcase_17 AC 29 ms
10,132 KB
testcase_18 AC 29 ms
10,132 KB
testcase_19 AC 30 ms
10,132 KB
testcase_20 AC 29 ms
10,132 KB
testcase_21 AC 30 ms
10,132 KB
testcase_22 AC 105 ms
19,328 KB
testcase_23 AC 101 ms
19,668 KB
testcase_24 AC 93 ms
19,076 KB
testcase_25 AC 98 ms
19,380 KB
testcase_26 AC 112 ms
20,148 KB
testcase_27 AC 107 ms
20,540 KB
testcase_28 AC 111 ms
20,808 KB
testcase_29 AC 99 ms
19,096 KB
testcase_30 AC 105 ms
19,864 KB
testcase_31 AC 100 ms
19,396 KB
testcase_32 AC 103 ms
19,280 KB
testcase_33 AC 102 ms
19,896 KB
testcase_34 AC 105 ms
20,156 KB
testcase_35 AC 112 ms
20,528 KB
testcase_36 AC 115 ms
20,708 KB
testcase_37 AC 111 ms
20,804 KB
testcase_38 AC 99 ms
19,144 KB
testcase_39 AC 102 ms
19,164 KB
testcase_40 AC 106 ms
19,832 KB
testcase_41 AC 110 ms
20,580 KB
testcase_42 AC 105 ms
16,928 KB
testcase_43 AC 105 ms
16,928 KB
testcase_44 AC 116 ms
20,856 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)]
t=(t-s)%N
a,b=t-1,N-t-1
ans=2*B[0]-sum(B)
u=v=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.append(B[1+u])
        if 2*v<b:
            add.append(B[N-1-v])
        ans+=2*max(add)
        break
print(ans)
0