結果

問題 No.482 あなたの名は
ユーザー ronpoo
提出日時 2023-10-31 11:46:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 283 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 103,040 KB
最終ジャッジ日時 2024-09-25 17:34:39
合計ジャッジ時間 4,677 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cnt = 0
for i in range(N):
    if D[i] != i+1:
        cnt += 1

if cnt % 2 == 0:
    cnt //= 2
else:
    cnt -= 1
    
if cnt > K:    
    print('NO')
elif (K-cnt) % 2 == 1:
    print('NO')
else:
    print('YES')
0