結果

問題 No.99 ジャンピング駒
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-06 15:10:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 871 ms / 5,000 ms
コード長 687 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 19,024 KB
最終ジャッジ日時 2023-08-14 22:41:01
合計ジャッジ時間 5,305 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 842 ms
18,892 KB
testcase_01 AC 843 ms
19,024 KB
testcase_02 AC 871 ms
18,928 KB
testcase_03 AC 704 ms
18,872 KB
testcase_04 AC 119 ms
18,988 KB
testcase_05 AC 121 ms
18,972 KB
権限があれば一括ダウンロードができます

ソースコード

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