結果
問題 |
No.482 あなたの名は
|
ユーザー |
|
提出日時 | 2017-02-11 00:42:05 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 455 bytes |
コンパイル時間 | 483 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 44,876 KB |
最終ジャッジ日時 | 2024-12-29 11:34:02 |
合計ジャッジ時間 | 6,638 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 15 WA * 13 |
ソースコード
n, k = [int(i) for i in input().split()] d = [int(i) - 1 for i in input().split()] e = [0 for i in range(n)] for i, dd in enumerate(d): e[dd] = i used_indices = set() hoge = list() for i in range(n): x = i y = 0 if x not in used_indices: used_indices.add(x) x = e[x] y += 1 if y > 0: hoge.append(y) x = sum(a - 1 for a in hoge) if x % 2 == k % 2 and x <= k: print('YES') else: print('NO')