結果

問題 No.1884 Sequence
ユーザー roarisroaris
提出日時 2022-03-25 23:49:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 118,748 KB
最終ジャッジ日時 2024-04-22 08:53:34
合計ジャッジ時間 6,074 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,808 KB
testcase_01 AC 38 ms
52,804 KB
testcase_02 AC 38 ms
53,328 KB
testcase_03 AC 38 ms
53,796 KB
testcase_04 AC 38 ms
52,488 KB
testcase_05 AC 39 ms
52,328 KB
testcase_06 AC 38 ms
52,680 KB
testcase_07 AC 38 ms
53,212 KB
testcase_08 AC 37 ms
52,668 KB
testcase_09 AC 38 ms
52,528 KB
testcase_10 AC 190 ms
118,064 KB
testcase_11 AC 186 ms
118,320 KB
testcase_12 AC 66 ms
88,032 KB
testcase_13 AC 68 ms
92,156 KB
testcase_14 AC 71 ms
91,896 KB
testcase_15 AC 117 ms
105,544 KB
testcase_16 AC 154 ms
118,096 KB
testcase_17 AC 94 ms
107,800 KB
testcase_18 AC 102 ms
106,332 KB
testcase_19 AC 95 ms
107,060 KB
testcase_20 AC 109 ms
105,368 KB
testcase_21 AC 102 ms
107,008 KB
testcase_22 AC 114 ms
105,292 KB
testcase_23 AC 153 ms
118,076 KB
testcase_24 AC 153 ms
118,748 KB
testcase_25 AC 155 ms
117,328 KB
testcase_26 AC 155 ms
118,120 KB
testcase_27 AC 72 ms
97,596 KB
testcase_28 AC 72 ms
97,500 KB
testcase_29 AC 73 ms
96,084 KB
testcase_30 AC 72 ms
97,080 KB
testcase_31 AC 105 ms
103,292 KB
testcase_32 AC 149 ms
117,152 KB
testcase_33 AC 110 ms
115,864 KB
testcase_34 AC 110 ms
115,852 KB
testcase_35 AC 77 ms
98,676 KB
testcase_36 AC 108 ms
106,368 KB
testcase_37 AC 112 ms
115,984 KB
testcase_38 AC 111 ms
114,252 KB
testcase_39 AC 85 ms
103,900 KB
testcase_40 AC 86 ms
104,648 KB
testcase_41 AC 142 ms
110,284 KB
testcase_42 AC 146 ms
110,028 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