提出 #27374383
ソースコード 拡げる
N,X=map(int, input().split())
A=list(map(int, input().split()))
sec=[False]*N
X-=1
sec[X]=True
for i in range(N):
if sec[A[X]-1]:
break
else:
sec[A[X]-1]=True
X=A[X]-1
ans=sec.count(True)
print(ans)
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Takahashi's Secret |
| ユーザ | nic_am |
| 言語 | Python (3.8.2) |
| 得点 | 200 |
| コード長 | 246 Byte |
| 結果 | AC |
| 実行時間 | 85 ms |
| メモリ | 20648 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, example0.txt, example1.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 000.txt | AC | 23 ms | 9040 KiB |
| 001.txt | AC | 83 ms | 20364 KiB |
| 002.txt | AC | 49 ms | 20260 KiB |
| 003.txt | AC | 48 ms | 20260 KiB |
| 004.txt | AC | 84 ms | 20364 KiB |
| 005.txt | AC | 48 ms | 20364 KiB |
| 006.txt | AC | 71 ms | 20364 KiB |
| 007.txt | AC | 69 ms | 20372 KiB |
| 008.txt | AC | 52 ms | 20420 KiB |
| 009.txt | AC | 62 ms | 20360 KiB |
| 010.txt | AC | 50 ms | 20648 KiB |
| 011.txt | AC | 47 ms | 20628 KiB |
| 012.txt | AC | 48 ms | 20344 KiB |
| 013.txt | AC | 69 ms | 20572 KiB |
| 014.txt | AC | 69 ms | 20536 KiB |
| 015.txt | AC | 85 ms | 20544 KiB |
| 016.txt | AC | 44 ms | 17636 KiB |
| 017.txt | AC | 30 ms | 14352 KiB |
| 018.txt | AC | 36 ms | 13544 KiB |
| 019.txt | AC | 49 ms | 20268 KiB |
| 020.txt | AC | 49 ms | 20368 KiB |
| 021.txt | AC | 48 ms | 20540 KiB |
| 022.txt | AC | 50 ms | 20360 KiB |
| 023.txt | AC | 48 ms | 20260 KiB |
| example0.txt | AC | 20 ms | 8980 KiB |
| example1.txt | AC | 20 ms | 9040 KiB |