結果

問題 No.1884 Sequence
ユーザー miscalcmiscalc
提出日時 2022-03-07 14:29:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 520 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 31,872 KB
最終ジャッジ日時 2023-09-29 15:20:41
合計ジャッジ時間 9,350 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,988 KB
testcase_01 AC 16 ms
7,972 KB
testcase_02 RE -
testcase_03 AC 16 ms
8,268 KB
testcase_04 AC 16 ms
7,976 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 15 ms
7,976 KB
testcase_08 AC 16 ms
7,932 KB
testcase_09 WA -
testcase_10 AC 355 ms
31,684 KB
testcase_11 AC 369 ms
31,764 KB
testcase_12 AC 57 ms
10,896 KB
testcase_13 AC 61 ms
11,128 KB
testcase_14 AC 60 ms
11,384 KB
testcase_15 AC 220 ms
20,620 KB
testcase_16 AC 377 ms
31,720 KB
testcase_17 AC 128 ms
19,116 KB
testcase_18 AC 191 ms
22,012 KB
testcase_19 AC 151 ms
18,936 KB
testcase_20 AC 180 ms
18,264 KB
testcase_21 AC 138 ms
16,892 KB
testcase_22 AC 202 ms
19,452 KB
testcase_23 AC 376 ms
29,988 KB
testcase_24 AC 365 ms
31,748 KB
testcase_25 AC 367 ms
29,992 KB
testcase_26 AC 376 ms
31,820 KB
testcase_27 AC 67 ms
12,092 KB
testcase_28 AC 67 ms
12,148 KB
testcase_29 AC 67 ms
11,980 KB
testcase_30 AC 67 ms
11,980 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 287 ms
26,188 KB
testcase_42 AC 297 ms
26,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys

n = int(input())
a = list(map(int, input().split()))

c = []
for i in range(n):
  if a[i] != 0:
    c.append(a[i])
k = len(c)
if k == 0:
  print('Yes')
  sys.exit(0)

c = sorted(c)
d = []
for i in range(k - 1):
  d.append(c[i + 1] - c[i])

zerocnt = d.count(0)
if zerocnt > 0:
  print('Yes' if zerocnt == k - 1 else 'No')
  sys.exit

g = 0
for i in range(k - 1):
  g = math.gcd(g, d[i])

need = 0
for i in range(k - 1):
  tmp = d[i] / g - 1
  need += tmp

print('Yes' if need <= n - k else 'No')
0