結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー Chihaya_chanChihaya_chan
提出日時 2020-09-05 01:32:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,114 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,832 KB
最終ジャッジ日時 2024-05-05 04:02:10
合計ジャッジ時間 4,093 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def judge(a, b):
    if b % 2 == 0:
        if a <= b//2:
            return 0
        else:
            return 100
    if b % 2 != 0:
        if a < (b+1)//2:
            return 0
        elif a == (b+1)//2:
            return 1
        else:
            return 100


def main():
    N = int(input())
    s, t = map(int, input().split())
    A = list(map(int, input().split()))
    if s > t:
        s = N+1-s
        t = N+1-t
        A = A[::-1]
    R = A[s:t-1]
    L = A[t:] + A[:s-1]
    L = L[::-1]
    len_R = len(R)
    len_L = len(L)
    K = (N-1)//2
    ans = A[s-1]
    Sum_A = sum(A)
    R.insert(0, 0)
    L.insert(0, 0)
    for i in range(1, len_R+1):
        R[i] += R[i-1]
    for i in range(1, len_L+1):
        L[i] += L[i-1]

    for i in range(len_R+1):
        if 0 <= K-i <= len_L:
            try_max = L[K-i] + R[i] + A[s-1]
            if try_max > ans:
                ban = 0
                ban + judge(K-i, len_L) + judge(i, len_R)
                if ban <= 1:
                    ans = try_max
    res = 2*ans - Sum_A
    print(res)
    return


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