結果

問題 No.482 あなたの名は
ユーザー fagfagdfa
提出日時 2017-09-06 01:58:15
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 640 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 23,740 KB
最終ジャッジ日時 2024-11-06 23:25:09
合計ジャッジ時間 4,212 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, raw_input().split())
a = map(int, raw_input().split())

ct = 0

for i in range(len(a)):
    if i != a[i] - 1:
        ct += 1

if ct / 2 == k:
    print "YES"
elif ct == 0 and k % 2 == 0:
    print "YES"
elif ct / 2 < k and (k - (ct / 2)) % 2 == 0:
    print "YES"
else:
    print "NO"


0