結果
問題 |
No.482 あなたの名は
|
ユーザー |
|
提出日時 | 2020-04-06 00:12:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 313 bytes |
コンパイル時間 | 183 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 29,552 KB |
最終ジャッジ日時 | 2024-07-04 17:44:05 |
合計ジャッジ時間 | 4,758 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 9 |
ソースコード
N, K = map(int, input().split()) D = list(map(int, input().split())) done = [0] * (N + 1) cnt = 0 for i in range(N): if D[i] == i + 1: continue if not done[D[i]] or not done[i + 1]: cnt += 1 done[D[i]] = done[i + 1] = True yes = cnt <= K and cnt % 2 == K % 2 print('YES' if yes else 'NO')