結果

問題 No.482 あなたの名は
ユーザー ああいい
提出日時 2022-03-24 20:22:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 103,680 KB
最終ジャッジ日時 2024-10-13 04:03:39
合計ジャッジ時間 3,169 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
D = list(map(int,input().split()))

count = 0
i = 0
while i < N:
    if D[i] != i + 1:
        j = D[i]
        D[i],D[j-1] = D[j-1],D[i]
        count += 1
    else:
        i += 1
if count <= K and (K-count)%2 == 0:
    print('YES')
else:
    print('NO')
0