結果

問題 No.1884 Sequence
ユーザー vwxyzvwxyz
提出日時 2023-11-21 08:48:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 1,136 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 38,804 KB
最終ジャッジ日時 2023-11-21 08:48:16
合計ジャッジ時間 10,490 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
11,008 KB
testcase_01 AC 36 ms
11,008 KB
testcase_02 AC 51 ms
11,008 KB
testcase_03 AC 37 ms
11,008 KB
testcase_04 AC 39 ms
11,008 KB
testcase_05 AC 37 ms
11,008 KB
testcase_06 AC 37 ms
11,008 KB
testcase_07 AC 38 ms
11,008 KB
testcase_08 AC 37 ms
11,008 KB
testcase_09 AC 54 ms
11,008 KB
testcase_10 AC 313 ms
36,600 KB
testcase_11 AC 315 ms
36,588 KB
testcase_12 AC 63 ms
12,672 KB
testcase_13 AC 66 ms
12,924 KB
testcase_14 AC 65 ms
13,184 KB
testcase_15 AC 205 ms
24,148 KB
testcase_16 AC 316 ms
38,804 KB
testcase_17 AC 114 ms
19,160 KB
testcase_18 AC 159 ms
25,196 KB
testcase_19 AC 140 ms
23,572 KB
testcase_20 AC 160 ms
20,352 KB
testcase_21 AC 126 ms
17,580 KB
testcase_22 AC 183 ms
23,816 KB
testcase_23 AC 334 ms
36,624 KB
testcase_24 AC 326 ms
38,800 KB
testcase_25 AC 350 ms
36,628 KB
testcase_26 AC 332 ms
36,832 KB
testcase_27 AC 71 ms
13,440 KB
testcase_28 AC 70 ms
13,440 KB
testcase_29 AC 72 ms
13,440 KB
testcase_30 AC 71 ms
13,440 KB
testcase_31 AC 103 ms
23,404 KB
testcase_32 AC 150 ms
38,428 KB
testcase_33 AC 118 ms
34,624 KB
testcase_34 AC 122 ms
34,624 KB
testcase_35 AC 74 ms
14,592 KB
testcase_36 AC 103 ms
26,264 KB
testcase_37 AC 125 ms
34,624 KB
testcase_38 AC 122 ms
34,228 KB
testcase_39 AC 86 ms
17,272 KB
testcase_40 AC 86 ms
17,636 KB
testcase_41 AC 263 ms
29,116 KB
testcase_42 AC 257 ms
29,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
#sys.set_int_max_str_digits(10**9)

N=int(readline())
A=[a for a in map(int,readline().split()) if a]
if len(set(A))<=1:
    ans="Yes"
else:
    if len(A)!=len(set(A)):
        ans="No"
    else:
        A.sort()
        g=0
        for a,b in zip(A,A[1:]):
            g=GCD(g,b-a)
        if max(A)-min(A)<=g*(N-1):
            ans="Yes"
        else:
            ans="No"
print(ans)
0