結果

問題 No.482 あなたの名は
ユーザー neko_the_shadowneko_the_shadow
提出日時 2017-02-11 15:10:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 10,500 KB
実行使用メモリ 38,652 KB
最終ジャッジ日時 2023-08-28 14:41:36
合計ジャッジ時間 4,863 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,936 KB
testcase_01 AC 16 ms
7,916 KB
testcase_02 AC 16 ms
7,892 KB
testcase_03 AC 16 ms
7,928 KB
testcase_04 AC 15 ms
7,880 KB
testcase_05 WA -
testcase_06 AC 16 ms
7,908 KB
testcase_07 AC 17 ms
8,440 KB
testcase_08 AC 17 ms
7,984 KB
testcase_09 AC 16 ms
8,060 KB
testcase_10 AC 16 ms
7,904 KB
testcase_11 AC 17 ms
8,356 KB
testcase_12 WA -
testcase_13 AC 16 ms
7,956 KB
testcase_14 AC 16 ms
8,100 KB
testcase_15 AC 189 ms
38,540 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 188 ms
38,416 KB
testcase_19 AC 190 ms
38,552 KB
testcase_20 AC 190 ms
38,380 KB
testcase_21 AC 189 ms
38,456 KB
testcase_22 AC 192 ms
38,492 KB
testcase_23 AC 188 ms
38,500 KB
testcase_24 AC 190 ms
38,456 KB
testcase_25 AC 188 ms
38,360 KB
testcase_26 WA -
testcase_27 AC 191 ms
38,368 KB
testcase_28 WA -
testcase_29 AC 178 ms
38,528 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

if __name__ == '__main__':
    n, k = map(int, input().split())
    numbers = [int(token) - 1 for token in input().split()]
    position = { number : idx for idx, number in enumerate(numbers)}

    cnt = 0
    for idx in range(len(numbers)):
        if numbers[idx] == idx: continue
        numbers[idx], numbers[position[idx]] = numbers[position[idx]], numbers[idx]
        cnt += 1
    
    print("YES" if cnt <= k and k % 2 == cnt % 2 else "NO")
0