結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-07 09:11:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 602 bytes |
| コンパイル時間 | 415 ms |
| コンパイル使用メモリ | 82,572 KB |
| 実行使用メモリ | 133,812 KB |
| 最終ジャッジ日時 | 2025-01-07 09:11:28 |
| 合計ジャッジ時間 | 8,392 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 RE * 4 |
ソースコード
N = int(input())
A = list(map(int,input().split()))
A0 = []
A1 = []
for i in range(N):
if A[i]>0:
A1.append(A[i])
else:
A0.append(A[i])
A1 = sorted(A1)
D = []
for i in range(len(A1)-1):
D.append(A1[i+1]-A1[i])
def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
if 0 in D:
if D.count(0)==len(D):
print("Yes")
else:
print("No")
else:
d = D[0]
for i in range(1,len(D)):
d = gcd(d,D[i])
cnt = 0
for i in range(len(D)):
cnt += D[i]//d-1
if cnt<=len(A0):
print("Yes")
else:
print("No")