結果

問題 No.1884 Sequence
ユーザー MasKoaTSMasKoaTS
提出日時 2022-03-25 21:41:14
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 1,064 bytes
コンパイル時間 958 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 132,792 KB
最終ジャッジ日時 2023-08-04 08:34:17
合計ジャッジ時間 12,646 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
81,404 KB
testcase_01 AC 183 ms
81,276 KB
testcase_02 AC 187 ms
81,392 KB
testcase_03 AC 183 ms
81,224 KB
testcase_04 AC 175 ms
81,132 KB
testcase_05 AC 184 ms
81,012 KB
testcase_06 AC 179 ms
81,172 KB
testcase_07 AC 182 ms
81,472 KB
testcase_08 AC 182 ms
81,228 KB
testcase_09 AC 178 ms
81,392 KB
testcase_10 AC 315 ms
132,564 KB
testcase_11 AC 313 ms
132,648 KB
testcase_12 AC 214 ms
105,268 KB
testcase_13 AC 214 ms
108,260 KB
testcase_14 AC 211 ms
105,608 KB
testcase_15 AC 251 ms
121,832 KB
testcase_16 AC 282 ms
132,428 KB
testcase_17 AC 221 ms
117,160 KB
testcase_18 AC 231 ms
123,000 KB
testcase_19 AC 228 ms
116,952 KB
testcase_20 AC 257 ms
119,348 KB
testcase_21 AC 251 ms
115,748 KB
testcase_22 AC 252 ms
120,332 KB
testcase_23 AC 279 ms
132,524 KB
testcase_24 AC 273 ms
132,060 KB
testcase_25 AC 286 ms
131,840 KB
testcase_26 AC 289 ms
132,792 KB
testcase_27 AC 212 ms
111,744 KB
testcase_28 AC 220 ms
111,872 KB
testcase_29 AC 216 ms
111,928 KB
testcase_30 AC 212 ms
111,860 KB
testcase_31 AC 241 ms
114,072 KB
testcase_32 AC 279 ms
132,100 KB
testcase_33 AC 235 ms
131,028 KB
testcase_34 AC 242 ms
131,084 KB
testcase_35 AC 231 ms
112,364 KB
testcase_36 AC 248 ms
123,936 KB
testcase_37 AC 245 ms
130,912 KB
testcase_38 AC 251 ms
130,072 KB
testcase_39 AC 232 ms
115,100 KB
testcase_40 AC 239 ms
116,084 KB
testcase_41 AC 278 ms
128,180 KB
testcase_42 AC 271 ms
127,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = sys.stdin.readline
input = lambda : inp().rstrip()
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda :list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 1000000007
MOD = 998244353
INF = 4611686018427387903
dx = [1, 0, -1, 0];	dy = [0, 1, 0, -1]


"""
Main Code
"""

n = getN()
a = sorted(getNs())

cnt = G = 0
d = []
for i in range(n - 1):
	if(a[i] == 0):
		cnt += 1
		continue
	d.append(a[i + 1] - a[i])
	G = math.gcd(G, d[-1])

if(G == 0):
	yexit()
if(0 in d):
	if all(a[i] == a[i + 1] for i in range(n - 1)):
		yexit()
	else:
		nexit()

#print(G, d)
for i in d:
	cnt -= i // G - 1
if(cnt >= 0):
	yexit()
else:
	nexit()
0