結果

問題 No.1884 Sequence
ユーザー chineristACchineristAC
提出日時 2022-03-25 23:17:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 128,796 KB
最終ジャッジ日時 2023-08-04 10:32:28
合計ジャッジ時間 9,185 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
74,760 KB
testcase_01 AC 104 ms
74,428 KB
testcase_02 AC 101 ms
74,272 KB
testcase_03 AC 103 ms
74,228 KB
testcase_04 AC 104 ms
74,876 KB
testcase_05 AC 104 ms
74,548 KB
testcase_06 AC 113 ms
74,820 KB
testcase_07 AC 98 ms
74,464 KB
testcase_08 AC 100 ms
74,320 KB
testcase_09 AC 101 ms
74,352 KB
testcase_10 AC 238 ms
128,672 KB
testcase_11 AC 239 ms
128,796 KB
testcase_12 AC 125 ms
101,192 KB
testcase_13 AC 129 ms
103,676 KB
testcase_14 AC 134 ms
102,656 KB
testcase_15 AC 180 ms
114,332 KB
testcase_16 AC 201 ms
128,208 KB
testcase_17 AC 154 ms
106,640 KB
testcase_18 AC 162 ms
116,124 KB
testcase_19 AC 159 ms
108,656 KB
testcase_20 AC 178 ms
110,764 KB
testcase_21 AC 177 ms
106,072 KB
testcase_22 AC 185 ms
112,704 KB
testcase_23 AC 202 ms
128,264 KB
testcase_24 AC 210 ms
128,444 KB
testcase_25 AC 210 ms
127,552 KB
testcase_26 AC 210 ms
128,492 KB
testcase_27 AC 137 ms
108,452 KB
testcase_28 AC 146 ms
108,464 KB
testcase_29 AC 137 ms
108,628 KB
testcase_30 AC 130 ms
108,628 KB
testcase_31 AC 162 ms
103,912 KB
testcase_32 AC 196 ms
125,832 KB
testcase_33 AC 165 ms
124,940 KB
testcase_34 AC 161 ms
125,136 KB
testcase_35 AC 146 ms
102,360 KB
testcase_36 AC 160 ms
116,536 KB
testcase_37 AC 162 ms
124,764 KB
testcase_38 AC 163 ms
123,776 KB
testcase_39 AC 147 ms
104,488 KB
testcase_40 AC 149 ms
104,740 KB
testcase_41 AC 195 ms
122,272 KB
testcase_42 AC 190 ms
122,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
A = li()

C = [a for a in A if a!=0]
C.sort()

if len(C) <= 1:
    exit(print("Yes"))

n = len(C)
if any(C[i]==C[i+1] for i in range(n-1)):
    if all(C[i]==C[i+1] for i in range(n-1)):
        exit(print("Yes"))
    else:
        exit(print("No"))

g = 0
for a,b in zip(C,C[1:]):
    g = gcd(g,b-a)

if max(C)-g*(N-1) <= min(C):
    print("Yes")
else:
    print("No")


0