結果

問題 No.1884 Sequence
ユーザー ああいいああいい
提出日時 2022-03-25 21:28:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 120,372 KB
最終ジャッジ日時 2024-04-22 06:03:41
合計ジャッジ時間 6,548 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 40 ms
51,456 KB
testcase_02 AC 41 ms
51,456 KB
testcase_03 AC 40 ms
51,840 KB
testcase_04 AC 40 ms
52,096 KB
testcase_05 AC 40 ms
51,968 KB
testcase_06 AC 40 ms
52,096 KB
testcase_07 AC 41 ms
51,712 KB
testcase_08 AC 41 ms
51,712 KB
testcase_09 AC 39 ms
51,840 KB
testcase_10 AC 192 ms
119,600 KB
testcase_11 AC 191 ms
120,372 KB
testcase_12 AC 75 ms
88,832 KB
testcase_13 AC 78 ms
92,672 KB
testcase_14 AC 84 ms
93,056 KB
testcase_15 AC 140 ms
107,264 KB
testcase_16 AC 174 ms
118,212 KB
testcase_17 AC 113 ms
109,568 KB
testcase_18 AC 120 ms
107,392 KB
testcase_19 AC 117 ms
108,544 KB
testcase_20 AC 132 ms
106,240 KB
testcase_21 AC 121 ms
108,416 KB
testcase_22 AC 138 ms
106,752 KB
testcase_23 AC 174 ms
118,452 KB
testcase_24 AC 174 ms
118,336 KB
testcase_25 AC 175 ms
117,428 KB
testcase_26 AC 175 ms
118,116 KB
testcase_27 AC 88 ms
96,256 KB
testcase_28 AC 82 ms
96,768 KB
testcase_29 AC 83 ms
96,640 KB
testcase_30 AC 83 ms
96,896 KB
testcase_31 AC 115 ms
104,832 KB
testcase_32 AC 160 ms
116,740 KB
testcase_33 AC 124 ms
115,960 KB
testcase_34 AC 124 ms
115,840 KB
testcase_35 AC 85 ms
98,944 KB
testcase_36 AC 119 ms
106,020 KB
testcase_37 AC 127 ms
116,464 KB
testcase_38 AC 125 ms
114,892 KB
testcase_39 AC 92 ms
103,296 KB
testcase_40 AC 96 ms
105,600 KB
testcase_41 AC 163 ms
110,104 KB
testcase_42 AC 164 ms
109,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
l = []
count = 0
for a in A:
    if a == 0:
        count += 1
    else:
        l.append(a)
l.sort()
import sys
if len(l) <= 1:
    print('Yes')
    exit()
def gcd(a,b):
    if b == 0:return a
    while True:
        r = a % b
        a = b
        b = r
        if r == 0:return a
flag = False
for i in range(len(l)-1):
    if l[i] == l[i+1]:
        flag = True
        break
if flag:
    if l[0] == l[-1]:
        print('Yes')
    else:
        print('No')
    exit()
    
d = 0
for i in range(len(l)-1):
    d = gcd(d,l[i+1]-l[i])
tmp = 0
for i in range(len(l)-1):
    tmp += (l[i+1]-l[i]) // d - 1
if tmp <= count:
    print('Yes')
else:
    print('No')
0