結果

問題 No.182 新規性の虜
ユーザー k.hk.h
提出日時 2019-08-04 16:01:05
言語 Go
(1.22.1)
結果
AC  
実行時間 978 ms / 5,000 ms
コード長 379 bytes
コンパイル時間 11,186 ms
コンパイル使用メモリ 207,804 KB
実行使用メモリ 7,948 KB
最終ジャッジ日時 2023-09-22 18:06:35
合計ジャッジ時間 20,338 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 605 ms
5,716 KB
testcase_09 AC 978 ms
7,948 KB
testcase_10 AC 848 ms
7,940 KB
testcase_11 AC 699 ms
7,940 KB
testcase_12 AC 297 ms
5,656 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 453 ms
7,940 KB
testcase_19 AC 319 ms
5,700 KB
testcase_20 AC 197 ms
5,660 KB
testcase_21 AC 518 ms
7,940 KB
testcase_22 AC 249 ms
5,676 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 705 ms
7,932 KB
testcase_25 AC 267 ms
7,920 KB
testcase_26 AC 127 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
evil01.txt AC 1,155 ms
8,092 KB
evil02.txt AC 1,149 ms
8,092 KB
権限があれば一括ダウンロードができます

ソースコード

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