結果
問題 |
No.1884 Sequence
|
ユーザー |
![]() |
提出日時 | 2022-03-25 21:34:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 497 bytes |
コンパイル時間 | 300 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 34,412 KB |
最終ジャッジ日時 | 2024-10-14 05:28:21 |
合計ジャッジ時間 | 9,677 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 WA * 5 RE * 2 |
ソースコード
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) == 0: 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")