結果

問題 No.482 あなたの名は
ユーザー maguroguma
提出日時 2017-08-17 19:42:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 29,664 KB
最終ジャッジ日時 2024-10-14 13:55:05
合計ジャッジ時間 4,217 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

N,K = map(int, input().split())
D = list(map(int, input().split()))

total = 0
for i in range(N):
    if D[i] != i+1:
        # D[i]とD[D[i]-1]を交換
        temp = D[i]
        D[i] = D[temp-1]
        D[temp-1] = temp
        total += 1

if total<=K and (K-total)%2==0:
    print('YES')
else:
    print('NO')
0