結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2018-05-22 21:49:00 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 290 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 30,540 KB |
最終ジャッジ日時 | 2024-06-28 15:53:31 |
合計ジャッジ時間 | 4,744 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 8 |
ソースコード
N, K = map(int, input().split()) a = tuple(map(int, input().split())) x = 0 pair = 0 for i, n in enumerate(a, start=1): if i == n: continue if a[n-1] == i: pair += 1 else: x += 1 x = max(0, x-1) + pair//2 print("YES" if x <= K and (K-x)%2 == 0 else "NO")