結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,080 KB
testcase_01 AC 30 ms
10,080 KB
testcase_02 AC 31 ms
10,080 KB
testcase_03 AC 30 ms
10,080 KB
testcase_04 AC 29 ms
10,080 KB
testcase_05 AC 30 ms
10,080 KB
testcase_06 AC 30 ms
10,080 KB
testcase_07 AC 29 ms
10,080 KB
testcase_08 AC 30 ms
10,080 KB
testcase_09 AC 29 ms
10,080 KB
testcase_10 AC 30 ms
10,080 KB
testcase_11 AC 30 ms
10,080 KB
testcase_12 AC 30 ms
10,080 KB
testcase_13 AC 30 ms
10,080 KB
testcase_14 AC 30 ms
10,080 KB
testcase_15 AC 30 ms
10,080 KB
testcase_16 AC 29 ms
10,080 KB
testcase_17 AC 31 ms
10,084 KB
testcase_18 AC 31 ms
10,084 KB
testcase_19 AC 30 ms
10,084 KB
testcase_20 AC 30 ms
10,084 KB
testcase_21 AC 29 ms
10,084 KB
testcase_22 AC 105 ms
19,280 KB
testcase_23 AC 101 ms
19,620 KB
testcase_24 AC 93 ms
19,028 KB
testcase_25 AC 98 ms
19,332 KB
testcase_26 AC 111 ms
20,100 KB
testcase_27 AC 108 ms
20,492 KB
testcase_28 AC 111 ms
20,760 KB
testcase_29 AC 100 ms
19,048 KB
testcase_30 AC 105 ms
19,816 KB
testcase_31 AC 101 ms
19,348 KB
testcase_32 AC 104 ms
19,232 KB
testcase_33 AC 104 ms
19,848 KB
testcase_34 AC 106 ms
20,108 KB
testcase_35 AC 114 ms
20,480 KB
testcase_36 AC 117 ms
20,660 KB
testcase_37 AC 112 ms
20,756 KB
testcase_38 AC 98 ms
19,096 KB
testcase_39 AC 100 ms
19,116 KB
testcase_40 AC 105 ms
19,784 KB
testcase_41 AC 109 ms
20,532 KB
testcase_42 AC 105 ms
16,880 KB
testcase_43 AC 106 ms
16,880 KB
testcase_44 AC 119 ms
20,808 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
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