結果

問題 No.406 鴨等間隔の法則
ユーザー fmhrfmhr
提出日時 2016-08-05 22:52:20
言語 Go
(1.22.1)
結果
AC  
実行時間 1,080 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 9,765 ms
コンパイル使用メモリ 207,636 KB
実行使用メモリ 7,948 KB
最終ジャッジ日時 2023-09-21 17:48:41
合計ジャッジ時間 29,004 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 431 ms
5,680 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 965 ms
7,940 KB
testcase_05 AC 358 ms
5,664 KB
testcase_06 AC 376 ms
5,668 KB
testcase_07 AC 384 ms
5,672 KB
testcase_08 AC 949 ms
7,944 KB
testcase_09 AC 1,049 ms
7,932 KB
testcase_10 AC 425 ms
5,680 KB
testcase_11 AC 820 ms
7,944 KB
testcase_12 AC 524 ms
5,704 KB
testcase_13 AC 489 ms
5,696 KB
testcase_14 AC 871 ms
7,944 KB
testcase_15 AC 58 ms
4,380 KB
testcase_16 AC 72 ms
4,376 KB
testcase_17 AC 37 ms
4,376 KB
testcase_18 AC 80 ms
4,380 KB
testcase_19 AC 92 ms
4,380 KB
testcase_20 AC 128 ms
4,380 KB
testcase_21 AC 129 ms
4,376 KB
testcase_22 AC 236 ms
4,376 KB
testcase_23 AC 566 ms
5,704 KB
testcase_24 AC 776 ms
7,940 KB
testcase_25 AC 1,059 ms
7,948 KB
testcase_26 AC 1,072 ms
7,932 KB
testcase_27 AC 1,057 ms
7,940 KB
testcase_28 AC 1,040 ms
7,936 KB
testcase_29 AC 1,080 ms
7,936 KB
testcase_30 AC 1,050 ms
7,932 KB
testcase_31 AC 1,015 ms
7,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	x := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&x[i])
	}
	sort.Ints(x)
	z := x[1] - x[0]
	flag := true
	for i := 1; i < N; i++ {
		if x[i]-x[i-1] != z || z == 0 {
			flag = false
		}
	}
	if flag {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0