結果

問題 No.99 ジャンピング駒
ユーザー ABKZ
提出日時 2022-02-26 11:09:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 503 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 95,116 KB
最終ジャッジ日時 2024-07-04 06:42:11
合計ジャッジ時間 1,800 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
x_pos = deque(sorted(list(map(int, input().split()))))

cnt0 = 0
cnt1 = len(x_pos)
while cnt0 != cnt1:
    tmp = deque()
    while len(x_pos) > 0:
        if len(x_pos) == 1:
            tmp.append(x_pos.popleft())
            break
        x0 = x_pos.popleft()
        x1 = x_pos.popleft()
        if (x0 + x1) % 2 == 0:
            tmp.append(x0)
            x_pos.appendleft(x1)
    x_pos = tmp
    cnt0 = cnt1
    cnt1 = len(x_pos)

print(len(x_pos))
0