結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-01-27 14:33:48 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 102 ms / 2,000 ms |
| + 515µs | |
| コード長 | 411 bytes |
| 記録 | |
| コンパイル時間 | 244 ms |
| コンパイル使用メモリ | 96,204 KB |
| 実行使用メモリ | 115,968 KB |
| 最終ジャッジ日時 | 2026-09-05 15:24:32 |
| 合計ジャッジ時間 | 5,665 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
N, K = map(int, input().split())
D = list(map(int, input().split()))
nv = [False] * N
cnt2 = 0
for i in range(N):
if nv[i]:
continue
cnt = 0
nv[i] = True
next = D[i] - 1
while next != i:
cnt += 1
nv[next] = True
next = D[next] - 1
#print(i, nv)
cnt2 += cnt
if K < cnt2:
print("NO")
elif (K - cnt2) % 2 == 1:
print("NO")
else:
print("YES")
ntuda