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