結果

問題 No.1884 Sequence
ユーザー roarisroaris
提出日時 2022-03-25 23:49:53
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 120,268 KB
最終ジャッジ日時 2023-08-04 11:15:43
合計ジャッジ時間 8,645 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,180 KB
testcase_01 AC 74 ms
71,304 KB
testcase_02 AC 73 ms
71,320 KB
testcase_03 AC 74 ms
71,364 KB
testcase_04 AC 73 ms
71,368 KB
testcase_05 AC 72 ms
71,444 KB
testcase_06 AC 73 ms
71,244 KB
testcase_07 AC 72 ms
71,328 KB
testcase_08 AC 71 ms
71,544 KB
testcase_09 AC 75 ms
71,708 KB
testcase_10 AC 226 ms
119,856 KB
testcase_11 AC 218 ms
120,160 KB
testcase_12 AC 98 ms
97,492 KB
testcase_13 AC 100 ms
100,320 KB
testcase_14 AC 104 ms
98,232 KB
testcase_15 AC 155 ms
106,412 KB
testcase_16 AC 181 ms
120,192 KB
testcase_17 AC 120 ms
105,456 KB
testcase_18 AC 134 ms
106,948 KB
testcase_19 AC 119 ms
102,800 KB
testcase_20 AC 137 ms
106,144 KB
testcase_21 AC 130 ms
105,448 KB
testcase_22 AC 148 ms
105,280 KB
testcase_23 AC 178 ms
120,080 KB
testcase_24 AC 178 ms
119,988 KB
testcase_25 AC 179 ms
119,460 KB
testcase_26 AC 178 ms
120,268 KB
testcase_27 AC 103 ms
103,736 KB
testcase_28 AC 102 ms
103,796 KB
testcase_29 AC 103 ms
103,804 KB
testcase_30 AC 105 ms
103,660 KB
testcase_31 AC 130 ms
99,932 KB
testcase_32 AC 175 ms
119,104 KB
testcase_33 AC 138 ms
117,892 KB
testcase_34 AC 136 ms
117,780 KB
testcase_35 AC 111 ms
104,212 KB
testcase_36 AC 132 ms
107,356 KB
testcase_37 AC 135 ms
117,828 KB
testcase_38 AC 135 ms
116,644 KB
testcase_39 AC 112 ms
105,400 KB
testcase_40 AC 118 ms
105,768 KB
testcase_41 AC 173 ms
113,504 KB
testcase_42 AC 171 ms
112,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from math import gcd

N = int(input())
A = list(map(int, input().split()))
l = [Ai for Ai in A if Ai>0]
l.sort()

if len(l)==0 or l[0]==l[-1]:
    exit(print('Yes'))
    
G = 0

for i in range(len(l)-1):
    if l[i]==l[i+1]:
        exit(print('No'))
        
    G = gcd(G, l[i+1]-l[i])

if G==0:
    exit(print('Yes'))
    
cnt = 0

for i in range(len(l)-1):
    cnt += (l[i+1]-l[i])//G-1

if cnt<=N-len(l):
    print('Yes')
else:
    print('No')
0