結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
k_o_pasture
|
| 提出日時 | 2022-03-25 21:54:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 483 bytes |
| コンパイル時間 | 338 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 34,408 KB |
| 最終ジャッジ日時 | 2024-10-14 05:50:20 |
| 合計ジャッジ時間 | 9,788 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 5 |
ソースコード
from math import *
N = int(input())
A = sorted(list(map(int, input().split())))
c = 0 # 0 の数
B = []
for a in A:
if a == 0:
c += 1
else:
B.append(a)
# print('c',c)
# print('B',B)
D = [] # 差
for i in range(1,len(B)):
D.append(B[i]-B[i-1])
# print('D',D)
if len(D) == len([d for d in D if d == 0]):
print('Yes')
exit()
G = gcd(*D) # 差の最大公約数
# print('G',G)
s = 0
for d in D:
s += (d // G) - 1
# print('s',s)
if c >= s:
print('Yes')
else:
print('No')
k_o_pasture