結果

問題 No.482 あなたの名は
コンテスト
ユーザー Meso Meso
提出日時 2025-12-21 09:58:01
言語 Python3
(3.14.2 + numpy 2.4.0 + scipy 1.16.3)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 267 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 242 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 29,096 KB
最終ジャッジ日時 2025-12-21 09:58:08
合計ジャッジ時間 5,715 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))  
x = 0

for i in range(1, n + 1):
    while a[i] != i:
        t = a[i]
        a[i], a[t] = a[t], a[i]  
        x += 1

if x <= k and x % 2 == k % 2:
    print("YES")
else:
    print("NO")
0