結果

問題 No.999 てん vs. ほむ
ユーザー nasnas
提出日時 2020-03-06 21:09:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 367 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 96,128 KB
最終ジャッジ日時 2024-04-22 04:32:37
合計ジャッジ時間 15,769 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,840 KB
testcase_01 AC 42 ms
51,712 KB
testcase_02 AC 41 ms
51,584 KB
testcase_03 AC 42 ms
51,840 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 WA -
testcase_17 AC 86 ms
87,168 KB
testcase_18 AC 1,974 ms
87,168 KB
testcase_19 AC 87 ms
87,424 KB
testcase_20 TLE -
testcase_21 AC 841 ms
96,000 KB
testcase_22 AC 1,366 ms
96,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == '__main__':
    n=int(input())
    A=[int(i) for i in input().split()]
    ans=0
    while 1:
        if len(A)==1:
            ans+=A[0]
            break
        if len(A)==0:
            break
        if A[0]>A[-1]:
            ans+=A[0]-A[1]
            del A[0:2]
        else:
            ans+=A[-1]-A[-2]
            del A[-2:]

    print(ans)

0