結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-11 17:09:19 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 379 bytes |
| 記録 | |
| コンパイル時間 | 90 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 29,684 KB |
| 最終ジャッジ日時 | 2024-12-29 16:30:56 |
| 合計ジャッジ時間 | 4,808 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 10 |
ソースコード
n,k=map(int,input().split())
d=list(map(lambda x: x-1, map(int,input().split())))
dif=False
cnt=0
for i in range(n):
j = d[i]
if d[i] == i: continue
if d[j] == i:
cnt+=1
d[i] = i
d[j] = j
else:
cnt+=1
dif = True
if dif and k >= cnt:
print("YES")
else:
print("YES" if cnt == k or (k>cnt and (k-cnt)&1==0) else "NO")