結果

問題 No.999 てん vs. ほむ
ユーザー Orutoba
提出日時 2020-04-26 03:18:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 38,016 KB
最終ジャッジ日時 2024-11-09 00:32:44
合計ジャッジ時間 8,748 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 WA * 8 TLE * 2 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())*2
cards = list(map(int, input().split()))
homura = 0
tempura = 0
homura_select = 0
for i in range(N):
    if i % 2 == 0:
        if cards[0] > cards[-1]:
            homura += cards[0]
            cards.pop(0)
            homura_select = 0
        else:
            homura += cards[-1]
            cards.pop(-1)
            homura_select = -1
    else:
        tempura += cards[homura_select]
        cards.pop(homura_select)
ans = homura - tempura
print(ans)
0