結果

問題 No.1884 Sequence
ユーザー Yuto OhnukiYuto Ohnuki
提出日時 2022-04-01 22:34:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 166,888 KB
最終ジャッジ日時 2024-04-30 14:49:24
合計ジャッジ時間 6,330 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
54,932 KB
testcase_01 AC 38 ms
54,928 KB
testcase_02 AC 38 ms
56,560 KB
testcase_03 AC 40 ms
55,724 KB
testcase_04 AC 41 ms
56,344 KB
testcase_05 AC 37 ms
56,132 KB
testcase_06 AC 38 ms
54,568 KB
testcase_07 AC 38 ms
55,704 KB
testcase_08 AC 38 ms
55,936 KB
testcase_09 AC 37 ms
55,648 KB
testcase_10 AC 178 ms
166,260 KB
testcase_11 AC 177 ms
166,776 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 70 ms
94,768 KB
testcase_15 AC 140 ms
126,428 KB
testcase_16 AC 177 ms
166,516 KB
testcase_17 AC 94 ms
105,160 KB
testcase_18 AC 123 ms
129,672 KB
testcase_19 AC 102 ms
102,728 KB
testcase_20 AC 126 ms
120,060 KB
testcase_21 AC 100 ms
104,440 KB
testcase_22 AC 135 ms
123,368 KB
testcase_23 AC 176 ms
166,888 KB
testcase_24 AC 175 ms
166,572 KB
testcase_25 AC 178 ms
165,048 KB
testcase_26 AC 183 ms
166,468 KB
testcase_27 AC 72 ms
98,784 KB
testcase_28 AC 72 ms
98,444 KB
testcase_29 AC 72 ms
98,752 KB
testcase_30 AC 71 ms
98,480 KB
testcase_31 AC 117 ms
102,188 KB
testcase_32 AC 186 ms
164,740 KB
testcase_33 AC 106 ms
120,328 KB
testcase_34 AC 105 ms
119,808 KB
testcase_35 AC 76 ms
102,052 KB
testcase_36 AC 104 ms
109,584 KB
testcase_37 AC 106 ms
120,176 KB
testcase_38 AC 105 ms
119,228 KB
testcase_39 AC 85 ms
105,140 KB
testcase_40 AC 88 ms
104,668 KB
testcase_41 AC 168 ms
148,336 KB
testcase_42 AC 159 ms
147,952 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)
  if set(a)=={0}:
    print('Yes')
  else:
    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