結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-25 23:49:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 473 bytes |
| コンパイル時間 | 166 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 118,720 KB |
| 最終ジャッジ日時 | 2024-10-14 08:06:00 |
| 合計ジャッジ時間 | 5,938 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 RE * 2 |
ソースコード
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 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')