結果

問題 No.482 あなたの名は
ユーザー JunOnuma
提出日時 2017-05-24 11:05:17
言語 Python2
(2.7.18)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 23,736 KB
最終ジャッジ日時 2024-09-19 16:03:32
合計ジャッジ時間 5,040 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

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