結果

問題 No.182 新規性の虜
ユーザー k.h
提出日時 2019-08-04 16:01:05
言語 Go
(1.23.4)
結果
AC  
実行時間 835 ms / 5,000 ms
コード長 379 bytes
コンパイル時間 10,270 ms
コンパイル使用メモリ 228,472 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-08 09:25:51
合計ジャッジ時間 18,583 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, rlt int
	fmt.Scan(&N)
	if N == 1 {
		fmt.Println("1")
		return
	}
	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	for i := 1; i < N-1; i++ {
		if a[i] != a[i-1] && a[i] != a[i+1] {
			rlt++
		}
	}
	if a[0] != a[1] {
		rlt++
	}
	if a[N-1] != a[N-2] {
		rlt++
	}
	fmt.Println(rlt)
}
0