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