結果

問題 No.3217 Shiki no Shiki
ユーザー ID 21712
提出日時 2025-08-02 06:22:51
言語 Go
(1.23.4)
結果
AC  
実行時間 764 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 13,638 ms
コンパイル使用メモリ 254,376 KB
実行使用メモリ 9,616 KB
最終ジャッジ日時 2025-08-02 06:23:14
合計ジャッジ時間 21,793 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import . "fmt"

func main() {
	var n int
	Scan(&n)
	ps:=make([]int,n)
	t:=map[int]bool{}
	for i:=range ps {
		Scan(&ps[i])
		t[ps[i]]=true
	}
	m:=map[int]bool{}
	for i,p:=range ps {
		if t[i+1] {
			continue
		}
		m[p]=true
	}
	a:=map[int]bool{}
	for i,p:=range ps {
		if m[i+1]&&p>0 {
			a[p]=true
		}
	}
	Println(len(a))
}
0