結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,956 KB
testcase_01 AC 16 ms
8,112 KB
testcase_02 AC 16 ms
7,932 KB
testcase_03 AC 16 ms
7,924 KB
testcase_04 AC 16 ms
8,108 KB
testcase_05 WA -
testcase_06 AC 16 ms
8,084 KB
testcase_07 AC 16 ms
8,124 KB
testcase_08 AC 16 ms
7,960 KB
testcase_09 AC 16 ms
7,944 KB
testcase_10 AC 16 ms
7,936 KB
testcase_11 AC 16 ms
8,460 KB
testcase_12 WA -
testcase_13 AC 16 ms
7,952 KB
testcase_14 AC 16 ms
7,920 KB
testcase_15 AC 181 ms
38,516 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 179 ms
38,448 KB
testcase_19 AC 186 ms
38,512 KB
testcase_20 AC 183 ms
38,456 KB
testcase_21 AC 186 ms
38,368 KB
testcase_22 AC 181 ms
38,580 KB
testcase_23 AC 181 ms
38,440 KB
testcase_24 AC 187 ms
38,552 KB
testcase_25 AC 183 ms
38,392 KB
testcase_26 WA -
testcase_27 AC 182 ms
38,600 KB
testcase_28 WA -
testcase_29 AC 175 ms
38,456 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 - cnt) % 2 == 0 else "NO")
0