結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2022-03-28 16:02:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 403 bytes |
| コンパイル時間 | 668 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 109,568 KB |
| 最終ジャッジ日時 | 2024-11-07 07:36:41 |
| 合計ジャッジ時間 | 8,287 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 RE * 10 |
ソースコード
import sys,bisect
input=lambda:sys.stdin.readline().rstrip()
def gcd(a,b):
m,M=min(a,b),max(a,b)
return M if m==0 else gcd(m,M%m)
N=int(input())
A=sorted(list(map(int,input().split())))
ind=bisect.bisect_right(A,0)
d,flg=0,0
for i in range(ind,N-1):
d=gcd(d,A[i+1]-A[i])
flg|=A[i]==A[i-1]
if flg:
print(['Yes','No'][d])
elif ind==N:
print('Yes')
else:
print(['Yes','No'][(A[-1]-A[ind])//d+1-N>0])
ytft