結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
iorion
|
| 提出日時 | 2022-03-25 21:36:08 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 34,288 KB |
| 最終ジャッジ日時 | 2024-10-14 05:30:44 |
| 合計ジャッジ時間 | 9,611 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 5 |
ソースコード
from math import gcd
from functools import reduce
n = int(input())
a = [*map(int, input().split())]
a.sort()
zeros = a.count(0)
s = [*filter(lambda x: x > 0, a)]
if len(s) <= 1:
print("Yes")
exit()
sabun = [y - x for x, y in zip(s, s[1:])]
g = reduce(gcd, sabun)
if g == 0:
if all(x == 0 for x in sabun):
print("Yes")
else:
print("No")
exit()
for x, y in zip(s, s[1:]):
zeros -= (y - x) // g - 1
if zeros >= 0:
print("Yes")
else:
print("No")
iorion