結果

問題 No.99 ジャンピング駒
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-06 15:10:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 898 ms / 5,000 ms
コード長 687 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,880 KB
最終ジャッジ日時 2024-11-23 00:01:29
合計ジャッジ時間 6,136 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
x_list = list(map(int,input().split()))

sorted_x = sorted(x_list)
res = 0

while True:
    cur_index = 0
    index_list = []
    before = len(sorted_x)
    
    while cur_index < before - 1:
        distance = sorted_x[cur_index + 1] - sorted_x[cur_index]
        if distance % 2 != 0:
            index_list.append(cur_index)
            cur_index += 2
        else:
            cur_index += 1
        
    for  i in range(len(index_list)):
        remove_index = index_list[i] - 2 * i
        sorted_x.pop(remove_index)
        sorted_x.pop(remove_index)
        
    after = len(sorted_x)
    if before == after:
        break
        
res = len(sorted_x)
print(res)
0