結果

問題 No.3217 Shiki no Shiki
コンテスト
ユーザー ID 21712
提出日時 2025-08-02 06:22:51
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
AC  
実行時間 346 ms / 2,000 ms
+ 804µs
コード長 338 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,109 ms
コンパイル使用メモリ 284,000 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2026-07-13 18:31:37
合計ジャッジ時間 15,517 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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