結果

問題 No.99 ジャンピング駒
ユーザー ABKZABKZ
提出日時 2022-02-26 11:09:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 172 ms / 5,000 ms
コード長 503 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 95,200 KB
最終ジャッジ日時 2023-09-17 10:30:26
合計ジャッジ時間 2,299 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 171 ms
94,476 KB
testcase_01 AC 171 ms
94,380 KB
testcase_02 AC 172 ms
94,596 KB
testcase_03 AC 171 ms
95,200 KB
testcase_04 AC 150 ms
94,192 KB
testcase_05 AC 154 ms
93,976 KB
権限があれば一括ダウンロードができます

ソースコード

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