結果

問題 No.1884 Sequence
ユーザー Yuto OhnukiYuto Ohnuki
提出日時 2022-04-01 22:28:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 135,824 KB
最終ジャッジ日時 2024-04-30 14:38:46
合計ジャッジ時間 7,840 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,576 KB
testcase_01 AC 45 ms
55,636 KB
testcase_02 AC 43 ms
55,080 KB
testcase_03 AC 44 ms
55,000 KB
testcase_04 AC 42 ms
55,380 KB
testcase_05 AC 43 ms
55,568 KB
testcase_06 AC 44 ms
55,412 KB
testcase_07 AC 44 ms
55,432 KB
testcase_08 AC 44 ms
56,024 KB
testcase_09 WA -
testcase_10 AC 169 ms
135,380 KB
testcase_11 AC 165 ms
135,512 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 78 ms
93,900 KB
testcase_15 AC 139 ms
112,392 KB
testcase_16 AC 171 ms
135,824 KB
testcase_17 AC 99 ms
104,908 KB
testcase_18 AC 122 ms
113,712 KB
testcase_19 AC 103 ms
102,220 KB
testcase_20 AC 129 ms
109,228 KB
testcase_21 AC 106 ms
104,920 KB
testcase_22 AC 133 ms
110,424 KB
testcase_23 AC 172 ms
135,264 KB
testcase_24 AC 171 ms
135,520 KB
testcase_25 AC 169 ms
133,992 KB
testcase_26 AC 169 ms
135,812 KB
testcase_27 AC 80 ms
99,516 KB
testcase_28 AC 79 ms
99,652 KB
testcase_29 AC 79 ms
98,624 KB
testcase_30 AC 78 ms
99,076 KB
testcase_31 AC 115 ms
99,476 KB
testcase_32 AC 171 ms
133,572 KB
testcase_33 AC 115 ms
120,092 KB
testcase_34 AC 114 ms
119,820 KB
testcase_35 AC 84 ms
102,528 KB
testcase_36 AC 112 ms
109,476 KB
testcase_37 AC 125 ms
120,224 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 164 ms
125,096 KB
testcase_42 AC 157 ms
124,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import heapq, math, itertools
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
inputs = sys.stdin.readline
mod = 10**9+7
inf = float('inf')
#sys.setrecursionlimit(10**7)

def main():
  n = int(input())
  a = list(map(int, inputs().split()))
  cnt, x = 0, []
  for aa in a:
    if aa==0:
      cnt += 1
    else:
      x.append(aa)
  x = sorted(x)
  y = []
  for i in range(1, len(x)):
    if x[i]-x[i-1]!=0:
      y.append(x[i]-x[i-1])
  if not y:
    print("Yes")
  else:
    d = min(y)
    flg = True
    num = 0
    for i in range(1, len(x)):
      dif = x[i]-x[i-1]
      if dif%d!=0:
        flg = False
      else:
        num += max((dif//d)-1,0)
        if num>cnt:
          flg = False
    print('Yes' if flg else 'No')


if __name__ == '__main__':
  main()
0