結果

問題 No.1884 Sequence
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-03-25 22:45:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 834 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 177,928 KB
最終ジャッジ日時 2024-04-22 07:29:22
合計ジャッジ時間 6,898 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,480 KB
testcase_01 AC 37 ms
52,352 KB
testcase_02 AC 37 ms
52,204 KB
testcase_03 AC 37 ms
52,736 KB
testcase_04 AC 37 ms
52,608 KB
testcase_05 AC 37 ms
51,456 KB
testcase_06 AC 38 ms
51,968 KB
testcase_07 AC 38 ms
51,840 KB
testcase_08 AC 39 ms
52,096 KB
testcase_09 AC 39 ms
51,456 KB
testcase_10 AC 230 ms
149,420 KB
testcase_11 AC 226 ms
149,808 KB
testcase_12 AC 67 ms
88,832 KB
testcase_13 AC 70 ms
92,672 KB
testcase_14 AC 76 ms
92,800 KB
testcase_15 AC 141 ms
108,160 KB
testcase_16 AC 194 ms
149,980 KB
testcase_17 AC 105 ms
106,112 KB
testcase_18 AC 122 ms
108,088 KB
testcase_19 AC 109 ms
104,448 KB
testcase_20 AC 132 ms
107,648 KB
testcase_21 AC 117 ms
106,112 KB
testcase_22 AC 137 ms
107,652 KB
testcase_23 AC 196 ms
149,940 KB
testcase_24 AC 187 ms
149,540 KB
testcase_25 AC 192 ms
148,652 KB
testcase_26 AC 200 ms
150,176 KB
testcase_27 AC 74 ms
96,768 KB
testcase_28 AC 77 ms
97,024 KB
testcase_29 AC 74 ms
97,100 KB
testcase_30 AC 75 ms
96,384 KB
testcase_31 AC 133 ms
107,268 KB
testcase_32 AC 218 ms
177,928 KB
testcase_33 AC 119 ms
116,292 KB
testcase_34 AC 122 ms
116,532 KB
testcase_35 AC 87 ms
100,608 KB
testcase_36 AC 124 ms
107,424 KB
testcase_37 AC 122 ms
116,728 KB
testcase_38 AC 122 ms
115,156 KB
testcase_39 AC 96 ms
104,960 KB
testcase_40 AC 98 ms
106,496 KB
testcase_41 AC 185 ms
133,984 KB
testcase_42 AC 179 ms
133,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
a.sort()
cnt = 0
idx = -1
sa = [0]
same = set()
flg = False
for i in range(n):
    if idx ==-1 and a[i] != 0:
        idx = i
        same.add(a[i])
    elif idx != -1:
        if a[i] in same:
            flg = True
        sa.append(a[i]-a[idx])
        same.add(a[i])
    else:
        cnt += 1
if flg:
    if cnt != 0:
        if len(set(a)) <= 2:
            print("Yes")
        else:
            print("No")
    else:
        if len(set(a))== 1:
            print("Yes")
        else:
            print("No")
else:
    import math
    gcd_ = 0
    for i in range(1,len(sa)):
        gcd_ = math.gcd(gcd_,sa[i]-sa[i-1])
    baf = 0 
    for i in range(1,len(sa)):
        baf += (sa[i] - sa[i-1])//gcd_ - 1
    if baf <= cnt:
        print("Yes")
    else:
        print("No")
0