結果

問題 No.482 あなたの名は
コンテスト
ユーザー JunOnuma
提出日時 2017-05-24 11:05:17
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 302 bytes
記録
コンパイル時間 379 ms
コンパイル使用メモリ 77,364 KB
最終ジャッジ日時 2025-12-03 23:50:06
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n,k = map(int, raw_input().split())
l = map(int, raw_input().split())
for i,j in enumerate(l):
    if j == i+1:
        continue
    p = j
    while p != i+1:
        t = l[p-1]
        l[p-1] = p
        p = t
        k -= 1
    l[i] = p
if k >= 0 and k % 2 == 0:
    print 'YES'
else:
    print 'NO'
0