結果

問題 No.1884 Sequence
ユーザー Yuto OhnukiYuto Ohnuki
提出日時 2022-04-01 22:38:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,124 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 82,780 KB
実行使用メモリ 166,908 KB
最終ジャッジ日時 2024-04-30 14:55:23
合計ジャッジ時間 7,097 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,388 KB
testcase_01 AC 43 ms
54,752 KB
testcase_02 AC 44 ms
56,196 KB
testcase_03 AC 43 ms
55,468 KB
testcase_04 AC 45 ms
55,992 KB
testcase_05 AC 43 ms
54,908 KB
testcase_06 AC 44 ms
54,624 KB
testcase_07 AC 43 ms
55,332 KB
testcase_08 AC 46 ms
55,508 KB
testcase_09 AC 43 ms
54,700 KB
testcase_10 AC 207 ms
166,464 KB
testcase_11 AC 199 ms
166,908 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 79 ms
94,316 KB
testcase_15 AC 157 ms
127,296 KB
testcase_16 AC 200 ms
166,640 KB
testcase_17 AC 111 ms
104,916 KB
testcase_18 AC 139 ms
129,844 KB
testcase_19 AC 115 ms
102,544 KB
testcase_20 AC 145 ms
119,956 KB
testcase_21 AC 114 ms
104,580 KB
testcase_22 AC 149 ms
123,244 KB
testcase_23 AC 202 ms
166,496 KB
testcase_24 AC 204 ms
166,424 KB
testcase_25 AC 202 ms
165,808 KB
testcase_26 AC 204 ms
166,280 KB
testcase_27 AC 80 ms
98,720 KB
testcase_28 AC 82 ms
98,784 KB
testcase_29 AC 80 ms
100,432 KB
testcase_30 AC 82 ms
99,148 KB
testcase_31 AC 131 ms
101,772 KB
testcase_32 AC 209 ms
165,296 KB
testcase_33 AC 119 ms
119,636 KB
testcase_34 AC 120 ms
120,172 KB
testcase_35 AC 86 ms
102,444 KB
testcase_36 AC 118 ms
109,816 KB
testcase_37 AC 122 ms
120,040 KB
testcase_38 AC 120 ms
119,340 KB
testcase_39 AC 98 ms
104,644 KB
testcase_40 AC 106 ms
104,912 KB
testcase_41 AC 184 ms
148,744 KB
testcase_42 AC 183 ms
147,816 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
      if len(x)==1:
        if cnt==0:
          print('No')
        else:
          print('Yes')
      else:
        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