結果

問題 No.482 あなたの名は
ユーザー Tatsuno
提出日時 2017-02-11 16:51:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 233 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 29,680 KB
最終ジャッジ日時 2024-12-29 16:29:37
合計ジャッジ時間 4,989 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
d=list(map(lambda x: x-1, map(int,input().split())))
cnt=0
for i in range(n):
    j = d[i]
    if i == j: continue
    cnt+=1
    d[j] = d[i]
print("YES" if cnt == k or (k>cnt and (k-cnt)&1==0) else "NO")
0