結果

問題 No.1884 Sequence
ユーザー titan23titan23
提出日時 2022-06-14 13:31:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 118,756 KB
最終ジャッジ日時 2024-04-10 06:50:41
合計ジャッジ時間 7,403 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
54,244 KB
testcase_01 AC 40 ms
55,464 KB
testcase_02 AC 40 ms
54,956 KB
testcase_03 AC 41 ms
54,996 KB
testcase_04 AC 41 ms
55,440 KB
testcase_05 AC 41 ms
55,476 KB
testcase_06 AC 40 ms
55,172 KB
testcase_07 AC 40 ms
55,052 KB
testcase_08 AC 41 ms
55,032 KB
testcase_09 WA -
testcase_10 AC 180 ms
118,632 KB
testcase_11 AC 181 ms
118,756 KB
testcase_12 AC 71 ms
91,484 KB
testcase_13 AC 76 ms
93,948 KB
testcase_14 AC 77 ms
93,452 KB
testcase_15 AC 132 ms
101,020 KB
testcase_16 AC 149 ms
107,116 KB
testcase_17 AC 94 ms
106,868 KB
testcase_18 AC 108 ms
100,524 KB
testcase_19 AC 95 ms
105,292 KB
testcase_20 AC 118 ms
106,968 KB
testcase_21 AC 108 ms
107,020 KB
testcase_22 AC 127 ms
100,608 KB
testcase_23 AC 150 ms
107,368 KB
testcase_24 AC 152 ms
106,988 KB
testcase_25 AC 150 ms
106,924 KB
testcase_26 AC 152 ms
107,584 KB
testcase_27 AC 77 ms
98,604 KB
testcase_28 AC 78 ms
99,712 KB
testcase_29 AC 78 ms
99,208 KB
testcase_30 AC 77 ms
99,356 KB
testcase_31 AC 112 ms
102,244 KB
testcase_32 WA -
testcase_33 AC 112 ms
106,440 KB
testcase_34 AC 112 ms
106,424 KB
testcase_35 AC 87 ms
102,548 KB
testcase_36 AC 118 ms
100,676 KB
testcase_37 AC 116 ms
106,412 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 143 ms
105,312 KB
testcase_42 AC 143 ms
104,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 中央ぞろえ

import sys
from collections import Counter
from math import gcd
input = lambda: sys.stdin.readline().rstrip()
inf = float('inf')

###############

n = int(input())
A = list(map(int, input().split()))
A.sort()
zero_cnt = 0
for i in range(n):
  if A[i] == 0:
    zero_cnt += 1
  else:
    break
C = A[zero_cnt:]
m = len(C)
if m <= 1:
  print('Yes')
  exit()
st = set()
for i in range(m-1):
  st.add(C[i+1] - C[i])
delta = 0
for i in st:
  delta = gcd(delta, i)
if delta == 0:
  if len(Counter(C)) >= 2:
    print('No')
  else:
    print('Yes')
  exit()
need = 0
for i in range(m-1):
  if (C[i+1] - C[i]) % delta != 0:
    print('No')
    exit()
  need += (C[i+1] - C[i]) // delta - 1
print('Yes' if need <= zero_cnt else 'No')
0