結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2020-06-18 22:48:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 309 ms / 2,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 74 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 30,416 KB |
最終ジャッジ日時 | 2024-07-03 13:02:28 |
合計ジャッジ時間 | 7,016 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
N,K = map(int, input().split()) D = [int(d) for d in input().split()] done = [0]*N cnt = 0 for i in range(N): j = i temp = 0 while done[j-1] == 0: done[j-1] = 1 j = D[j-1] temp += 1 cnt += max(0, temp-1) if cnt <= K and cnt%2 == K%2: print("YES") else: print("NO")