提出 #27375832
ソースコード 拡げる
n, x = map(int, input().split())
a = list(map(int, input().split()))
array = [0] * n
array[x-1] = 1
index = a[x-1]-1
for _ in range(n):
if array[index] == 1:
break
array[index] = 1
index = a[index]-1
count = 0
for i in range(n):
if array[i] == 1:
count += 1
print(count)
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Takahashi's Secret |
| ユーザ | hmsket |
| 言語 | PyPy3 (7.3.0) |
| 得点 | 200 |
| コード長 | 324 Byte |
| 結果 | AC |
| 実行時間 | 82 ms |
| メモリ | 84736 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 | 68 ms | 61592 KiB |
| 001.txt | AC | 80 ms | 84484 KiB |
| 002.txt | AC | 80 ms | 84604 KiB |
| 003.txt | AC | 77 ms | 84492 KiB |
| 004.txt | AC | 81 ms | 84340 KiB |
| 005.txt | AC | 76 ms | 84472 KiB |
| 006.txt | AC | 78 ms | 84736 KiB |
| 007.txt | AC | 80 ms | 84676 KiB |
| 008.txt | AC | 75 ms | 84480 KiB |
| 009.txt | AC | 82 ms | 84660 KiB |
| 010.txt | AC | 77 ms | 84460 KiB |
| 011.txt | AC | 80 ms | 84608 KiB |
| 012.txt | AC | 76 ms | 84624 KiB |
| 013.txt | AC | 82 ms | 84520 KiB |
| 014.txt | AC | 81 ms | 84296 KiB |
| 015.txt | AC | 78 ms | 84492 KiB |
| 016.txt | AC | 73 ms | 81652 KiB |
| 017.txt | AC | 64 ms | 79868 KiB |
| 018.txt | AC | 65 ms | 78248 KiB |
| 019.txt | AC | 79 ms | 84320 KiB |
| 020.txt | AC | 77 ms | 84564 KiB |
| 021.txt | AC | 73 ms | 84704 KiB |
| 022.txt | AC | 77 ms | 84284 KiB |
| 023.txt | AC | 77 ms | 84460 KiB |
| example0.txt | AC | 51 ms | 61784 KiB |
| example1.txt | AC | 49 ms | 61612 KiB |