結果

問題 No.3217 Shiki no Shiki
ユーザー tkykwtnb
提出日時 2025-08-15 18:27:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 228 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 82,184 KB
実行使用メモリ 90,924 KB
最終ジャッジ日時 2025-08-15 18:27:16
合計ジャッジ時間 3,562 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
P=[0]+list(map(int,input().split()))
ans=0
for i,nxt in enumerate(P):
    grp=set([i])
    for _ in range(2):
        grp.add(nxt)
        nxt=P[nxt]
    if len(grp)==3 and 0 not in grp:
        ans+=1
print(ans)
0