結果

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

ソースコード

diff #

n,k=map(int,input().split())
d=list(map(lambda x: x-1, map(int,input().split())))
e=[0]*n
for i in range(n):
    e[d[i]] = i

cnt=0
for i in range(n):
    if d[i] == i: continue
    d[e[i]] = d[i]
    e[d[i]] = e[i]
    d[i] = i
    cnt+=1

print("YES" if k>=cnt and k&1==cnt&1 else "NO")
0