結果

問題 No.1884 Sequence
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-03-25 22:40:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 700 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 178,080 KB
最終ジャッジ日時 2024-04-22 07:24:07
合計ジャッジ時間 7,152 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,224 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 37 ms
51,456 KB
testcase_03 AC 41 ms
51,968 KB
testcase_04 AC 42 ms
51,840 KB
testcase_05 AC 37 ms
51,712 KB
testcase_06 AC 38 ms
52,224 KB
testcase_07 AC 37 ms
51,840 KB
testcase_08 AC 37 ms
52,096 KB
testcase_09 WA -
testcase_10 AC 223 ms
149,840 KB
testcase_11 AC 222 ms
149,580 KB
testcase_12 AC 69 ms
88,960 KB
testcase_13 AC 73 ms
92,416 KB
testcase_14 AC 79 ms
92,672 KB
testcase_15 AC 141 ms
108,160 KB
testcase_16 AC 243 ms
149,468 KB
testcase_17 AC 106 ms
105,984 KB
testcase_18 AC 121 ms
108,672 KB
testcase_19 AC 111 ms
104,448 KB
testcase_20 AC 133 ms
106,880 KB
testcase_21 AC 117 ms
106,496 KB
testcase_22 AC 135 ms
107,008 KB
testcase_23 AC 192 ms
149,460 KB
testcase_24 AC 186 ms
149,336 KB
testcase_25 AC 189 ms
148,680 KB
testcase_26 AC 191 ms
149,760 KB
testcase_27 AC 76 ms
96,896 KB
testcase_28 AC 77 ms
96,640 KB
testcase_29 AC 76 ms
96,512 KB
testcase_30 AC 76 ms
96,768 KB
testcase_31 AC 136 ms
107,244 KB
testcase_32 AC 222 ms
178,080 KB
testcase_33 AC 122 ms
116,884 KB
testcase_34 AC 122 ms
116,640 KB
testcase_35 AC 91 ms
100,224 KB
testcase_36 AC 125 ms
106,940 KB
testcase_37 AC 123 ms
116,256 KB
testcase_38 WA -
testcase_39 AC 99 ms
104,960 KB
testcase_40 AC 108 ms
106,880 KB
testcase_41 AC 184 ms
133,240 KB
testcase_42 AC 171 ms
133,112 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 len(set(a)) <= 2:
        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