結果

問題 No.1884 Sequence
ユーザー chineristACchineristAC
提出日時 2022-03-25 23:17:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 81,948 KB
実行使用メモリ 123,452 KB
最終ジャッジ日時 2024-04-22 08:13:28
合計ジャッジ時間 6,378 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
56,264 KB
testcase_01 AC 46 ms
56,768 KB
testcase_02 AC 45 ms
57,512 KB
testcase_03 AC 46 ms
56,676 KB
testcase_04 AC 45 ms
56,452 KB
testcase_05 AC 46 ms
56,036 KB
testcase_06 AC 46 ms
57,328 KB
testcase_07 AC 46 ms
56,332 KB
testcase_08 AC 46 ms
56,616 KB
testcase_09 AC 45 ms
57,728 KB
testcase_10 AC 197 ms
122,944 KB
testcase_11 AC 195 ms
123,316 KB
testcase_12 AC 75 ms
93,240 KB
testcase_13 AC 77 ms
95,840 KB
testcase_14 AC 80 ms
95,380 KB
testcase_15 AC 138 ms
106,868 KB
testcase_16 AC 161 ms
122,968 KB
testcase_17 AC 108 ms
103,012 KB
testcase_18 AC 119 ms
109,056 KB
testcase_19 AC 110 ms
102,728 KB
testcase_20 AC 130 ms
105,020 KB
testcase_21 AC 108 ms
106,388 KB
testcase_22 AC 131 ms
106,072 KB
testcase_23 AC 161 ms
122,936 KB
testcase_24 AC 161 ms
123,452 KB
testcase_25 AC 163 ms
122,552 KB
testcase_26 AC 164 ms
123,112 KB
testcase_27 AC 82 ms
100,396 KB
testcase_28 AC 80 ms
100,204 KB
testcase_29 AC 80 ms
100,244 KB
testcase_30 AC 81 ms
100,480 KB
testcase_31 AC 110 ms
101,264 KB
testcase_32 AC 155 ms
120,216 KB
testcase_33 AC 122 ms
119,552 KB
testcase_34 AC 122 ms
119,796 KB
testcase_35 AC 91 ms
105,332 KB
testcase_36 AC 118 ms
109,764 KB
testcase_37 AC 117 ms
119,440 KB
testcase_38 AC 120 ms
118,160 KB
testcase_39 AC 98 ms
106,272 KB
testcase_40 AC 95 ms
106,220 KB
testcase_41 AC 151 ms
116,868 KB
testcase_42 AC 154 ms
116,588 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