結果

問題 No.1884 Sequence
ユーザー Yuto OhnukiYuto Ohnuki
提出日時 2022-04-01 22:30:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 902 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 135,580 KB
最終ジャッジ日時 2024-04-30 14:42:20
合計ジャッジ時間 6,646 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,064 KB
testcase_01 AC 45 ms
54,940 KB
testcase_02 AC 44 ms
54,652 KB
testcase_03 AC 46 ms
55,544 KB
testcase_04 AC 45 ms
55,508 KB
testcase_05 AC 44 ms
55,064 KB
testcase_06 AC 44 ms
56,228 KB
testcase_07 AC 45 ms
54,724 KB
testcase_08 AC 44 ms
56,456 KB
testcase_09 AC 46 ms
55,200 KB
testcase_10 AC 170 ms
135,368 KB
testcase_11 AC 171 ms
135,580 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 78 ms
94,196 KB
testcase_15 AC 142 ms
112,428 KB
testcase_16 AC 177 ms
135,524 KB
testcase_17 AC 107 ms
105,324 KB
testcase_18 AC 129 ms
113,704 KB
testcase_19 AC 112 ms
102,584 KB
testcase_20 AC 139 ms
109,036 KB
testcase_21 AC 107 ms
104,948 KB
testcase_22 AC 139 ms
111,056 KB
testcase_23 AC 173 ms
135,096 KB
testcase_24 AC 173 ms
135,512 KB
testcase_25 AC 175 ms
134,276 KB
testcase_26 AC 173 ms
135,400 KB
testcase_27 AC 80 ms
99,860 KB
testcase_28 AC 80 ms
98,856 KB
testcase_29 AC 80 ms
98,720 KB
testcase_30 AC 80 ms
99,016 KB
testcase_31 AC 118 ms
99,512 KB
testcase_32 AC 176 ms
133,456 KB
testcase_33 AC 119 ms
119,812 KB
testcase_34 AC 121 ms
120,100 KB
testcase_35 AC 86 ms
102,052 KB
testcase_36 AC 117 ms
109,608 KB
testcase_37 AC 120 ms
120,184 KB
testcase_38 AC 118 ms
119,124 KB
testcase_39 AC 97 ms
104,508 KB
testcase_40 AC 96 ms
105,136 KB
testcase_41 AC 162 ms
125,080 KB
testcase_42 AC 163 ms
124,560 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==0:
        if d!=0:
          flg = False
      elif 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