結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー Kiri8128Kiri8128
提出日時 2020-07-04 01:35:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 656 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-22 10:41:37
合計ジャッジ時間 3,546 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 27 ms
10,880 KB
testcase_03 AC 27 ms
10,624 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 27 ms
10,880 KB
testcase_06 AC 26 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 27 ms
10,880 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 27 ms
10,752 KB
testcase_13 AC 27 ms
10,752 KB
testcase_14 AC 28 ms
10,752 KB
testcase_15 AC 27 ms
10,880 KB
testcase_16 AC 29 ms
10,752 KB
testcase_17 AC 28 ms
10,752 KB
testcase_18 AC 27 ms
10,752 KB
testcase_19 AC 28 ms
10,752 KB
testcase_20 AC 28 ms
10,752 KB
testcase_21 AC 28 ms
10,880 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
assert 1 <= N <= 100
s, t = map(int, input().split())
assert 1 <= s <= N
assert 1 <= t <= N
assert s != t
s, t = s-1, t-1
A = [int(a) for a in input().split()]
assert len(A) == N
for a in A:
    assert 1 <= a <= 10 ** 9
su = sum(A)

if s < t:
    X = A[s+1:t]
    Y = (A[t+1:] + A[:s])[::-1]
else:
    X = A[t+1:s][::-1]
    Y = A[s+1:] + A[:t]

x, y = len(X), len(Y)

if x % 2 == y % 2 == 0:
    ans = (sum(X[:x//2] + Y[:y//2]) + A[s]) * 2 - su
elif x % 2 == y % 2 == 1:
    ans = (max(sum(X[:x//2+1] + Y[:y//2]), sum(X[:x//2] + Y[:y//2+1])) + A[s]) * 2 - su
else:
    ans = (sum(X[:(x+1)//2] + Y[:(y+1)//2]) + A[s]) * 2 - su

print(ans)
0