結果

問題 No.99 ジャンピング駒
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-06 15:10:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 949 ms / 5,000 ms
コード長 687 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 22,004 KB
最終ジャッジ日時 2024-05-02 10:50:53
合計ジャッジ時間 5,801 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 949 ms
21,884 KB
testcase_01 AC 863 ms
21,876 KB
testcase_02 AC 890 ms
21,752 KB
testcase_03 AC 732 ms
21,748 KB
testcase_04 AC 139 ms
22,004 KB
testcase_05 AC 147 ms
21,888 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