結果
| 問題 |
No.482 あなたの名は
|
| コンテスト | |
| ユーザー |
compass19
|
| 提出日時 | 2017-02-15 00:50:29 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 220 ms / 2,000 ms |
| コード長 | 405 bytes |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 29,544 KB |
| 最終ジャッジ日時 | 2024-12-29 22:48:52 |
| 合計ジャッジ時間 | 5,337 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
N, K = map(int, input().split())
D = ['dummy'] + list(map(int, input().split()))
# 巡回置換の検出
peo = dict()
ans = 0
for ix, i in enumerate(D):
if ix == 0 or (i in peo) or i == ix:
continue
key = i
_next = D[i]
while _next != key:
peo[_next] = True
_next = D[_next]
ans += 1
if K >= ans and K%2 == ans%2:
print('YES')
else:
print('NO')
compass19