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