結果
問題 | No.1884 Sequence |
ユーザー |
![]() |
提出日時 | 2022-03-25 23:15:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 257 ms / 2,000 ms |
コード長 | 570 bytes |
コンパイル時間 | 392 ms |
コンパイル使用メモリ | 82,596 KB |
実行使用メモリ | 181,208 KB |
最終ジャッジ日時 | 2024-10-14 07:25:25 |
合計ジャッジ時間 | 7,100 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
from math import gcdimport sysinput = sys.stdin.readlinedef solve():N=int(input())A=list(map(int,input().split()))if len(set(A)-set([0]))<=1:return TrueA.sort()cnt0=0d_lst = []for i in range(N-1):if A[i]==0:cnt0+=1continued = A[i+1]-A[i]d_lst.append(d)d_min = min(d_lst)if d_min==0:return Falseg = d_lst[0]for i in range(1,len(d_lst)):g=gcd(g,d_lst[i])for d in d_lst:cnt0 -= d//g-1return cnt0>=0print("Yes" if solve() else "No")