結果

問題 No.1884 Sequence
ユーザー MasKoaTSMasKoaTS
提出日時 2022-03-25 21:41:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 1,064 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 136,960 KB
最終ジャッジ日時 2024-04-22 06:22:45
合計ジャッジ時間 10,324 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
86,272 KB
testcase_01 AC 126 ms
86,656 KB
testcase_02 AC 125 ms
86,528 KB
testcase_03 AC 127 ms
86,144 KB
testcase_04 AC 126 ms
86,528 KB
testcase_05 AC 127 ms
86,400 KB
testcase_06 AC 128 ms
86,400 KB
testcase_07 AC 126 ms
86,272 KB
testcase_08 AC 127 ms
86,272 KB
testcase_09 AC 127 ms
85,888 KB
testcase_10 AC 273 ms
136,940 KB
testcase_11 AC 274 ms
136,960 KB
testcase_12 AC 163 ms
110,004 KB
testcase_13 AC 165 ms
112,384 KB
testcase_14 AC 170 ms
109,952 KB
testcase_15 AC 217 ms
125,952 KB
testcase_16 AC 239 ms
136,576 KB
testcase_17 AC 182 ms
121,344 KB
testcase_18 AC 193 ms
126,592 KB
testcase_19 AC 181 ms
121,216 KB
testcase_20 AC 207 ms
123,264 KB
testcase_21 AC 194 ms
119,808 KB
testcase_22 AC 210 ms
124,288 KB
testcase_23 AC 243 ms
136,576 KB
testcase_24 AC 243 ms
136,704 KB
testcase_25 AC 241 ms
136,192 KB
testcase_26 AC 240 ms
136,960 KB
testcase_27 AC 167 ms
115,968 KB
testcase_28 AC 167 ms
115,812 KB
testcase_29 AC 167 ms
115,840 KB
testcase_30 AC 167 ms
116,224 KB
testcase_31 AC 201 ms
118,200 KB
testcase_32 AC 235 ms
136,844 KB
testcase_33 AC 199 ms
135,424 KB
testcase_34 AC 198 ms
135,200 KB
testcase_35 AC 178 ms
116,224 KB
testcase_36 AC 200 ms
128,364 KB
testcase_37 AC 198 ms
135,040 KB
testcase_38 AC 199 ms
134,528 KB
testcase_39 AC 191 ms
119,552 KB
testcase_40 AC 192 ms
120,404 KB
testcase_41 AC 230 ms
132,352 KB
testcase_42 AC 229 ms
131,712 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