結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー tamatotamato
提出日時 2020-08-07 21:48:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 719 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 81,760 KB
実行使用メモリ 90,684 KB
最終ジャッジ日時 2023-10-25 00:43:41
合計ジャッジ時間 4,483 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,520 KB
testcase_01 AC 36 ms
53,520 KB
testcase_02 WA -
testcase_03 AC 37 ms
53,520 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 37 ms
53,520 KB
testcase_07 AC 37 ms
53,520 KB
testcase_08 AC 37 ms
53,520 KB
testcase_09 AC 37 ms
53,520 KB
testcase_10 AC 37 ms
53,520 KB
testcase_11 AC 37 ms
53,520 KB
testcase_12 AC 37 ms
53,520 KB
testcase_13 AC 37 ms
53,520 KB
testcase_14 AC 37 ms
53,520 KB
testcase_15 AC 39 ms
53,520 KB
testcase_16 AC 37 ms
53,520 KB
testcase_17 AC 40 ms
53,520 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 40 ms
53,520 KB
testcase_21 AC 41 ms
53,520 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 79 ms
87,820 KB
testcase_27 AC 80 ms
88,292 KB
testcase_28 WA -
testcase_29 AC 76 ms
85,636 KB
testcase_30 AC 73 ms
85,944 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 73 ms
85,952 KB
testcase_34 WA -
testcase_35 AC 79 ms
89,276 KB
testcase_36 AC 82 ms
90,684 KB
testcase_37 AC 76 ms
88,468 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 75 ms
88,124 KB
testcase_42 AC 69 ms
85,168 KB
testcase_43 AC 69 ms
85,168 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    A = list(map(int, input().split()))

    DS = [0] * N
    DT = [0] * N
    for i in range(N):
        DS[i] = min(abs(i - s), abs(i - (N+s)))
        DT[i] = min(abs(i - t), abs(i - (N + t)))

    ans = 0
    tmp = []
    for i in range(N):
        if DS[i] < DT[i]:
            ans += A[i]
        elif DS[i] > DT[i]:
            ans -= A[i]
        else:
            tmp.append(A[i])
    if len(tmp) == 2:
        ans += max(tmp) - min(tmp)
    elif len(tmp) == 1:
        ans += tmp[0]
    print(ans)


if __name__ == '__main__':
    main()
0