結果

問題 No.406 鴨等間隔の法則
ユーザー alcoholampalcoholamp
提出日時 2019-10-30 10:42:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 26,944 KB
最終ジャッジ日時 2023-09-21 19:09:28
合計ジャッジ時間 3,679 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
14,080 KB
testcase_01 AC 16 ms
7,856 KB
testcase_02 AC 15 ms
7,824 KB
testcase_03 AC 15 ms
7,788 KB
testcase_04 AC 106 ms
25,844 KB
testcase_05 AC 50 ms
13,448 KB
testcase_06 AC 49 ms
13,472 KB
testcase_07 AC 50 ms
13,716 KB
testcase_08 AC 112 ms
26,008 KB
testcase_09 AC 117 ms
26,416 KB
testcase_10 AC 53 ms
14,188 KB
testcase_11 AC 91 ms
19,956 KB
testcase_12 AC 65 ms
17,424 KB
testcase_13 AC 60 ms
17,144 KB
testcase_14 AC 95 ms
20,564 KB
testcase_15 AC 18 ms
8,572 KB
testcase_16 AC 22 ms
9,668 KB
testcase_17 AC 19 ms
9,032 KB
testcase_18 AC 22 ms
9,776 KB
testcase_19 AC 23 ms
9,456 KB
testcase_20 AC 26 ms
10,232 KB
testcase_21 AC 27 ms
10,580 KB
testcase_22 AC 36 ms
12,252 KB
testcase_23 AC 67 ms
17,672 KB
testcase_24 AC 82 ms
19,608 KB
testcase_25 AC 122 ms
26,512 KB
testcase_26 AC 110 ms
26,860 KB
testcase_27 AC 62 ms
15,864 KB
testcase_28 AC 91 ms
26,944 KB
testcase_29 AC 110 ms
26,912 KB
testcase_30 AC 111 ms
26,644 KB
testcase_31 AC 114 ms
26,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Problem0406:
	def solve(this):
		n = int(input())
		
		c1 = True
		res = {}
		for i in map(int, input().split()):
			res[i] = res.get(i, 0) + 1
			if res[i] >= 2:
				c1 = False
		
		t = sorted(list(res.keys()))
		c2 = {}
		for i in range(len(t) - 1):
			k = abs(t[i+1] - t[i])
			c2[k] = c2.get(k, 0) + 1
		
		if c1 and len(c2) == 1:
			print("YES")
		else:
			print("NO")
			
if __name__ == "__main__":
	problem = Problem0406()
	problem.solve()
0