結果

問題 No.1884 Sequence
ユーザー Yuto OhnukiYuto Ohnuki
提出日時 2022-04-01 22:32:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 985 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 82,700 KB
実行使用メモリ 135,752 KB
最終ジャッジ日時 2024-04-30 14:45:00
合計ジャッジ時間 5,651 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
56,708 KB
testcase_01 AC 41 ms
56,096 KB
testcase_02 AC 37 ms
56,196 KB
testcase_03 AC 41 ms
55,124 KB
testcase_04 AC 38 ms
56,256 KB
testcase_05 AC 36 ms
55,220 KB
testcase_06 AC 41 ms
55,252 KB
testcase_07 AC 37 ms
56,848 KB
testcase_08 AC 36 ms
55,944 KB
testcase_09 AC 36 ms
55,248 KB
testcase_10 AC 145 ms
135,200 KB
testcase_11 AC 145 ms
135,332 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 67 ms
95,208 KB
testcase_15 AC 119 ms
112,836 KB
testcase_16 AC 146 ms
135,348 KB
testcase_17 AC 86 ms
104,980 KB
testcase_18 AC 106 ms
113,928 KB
testcase_19 AC 90 ms
102,380 KB
testcase_20 AC 113 ms
109,160 KB
testcase_21 AC 90 ms
104,532 KB
testcase_22 AC 114 ms
110,648 KB
testcase_23 AC 147 ms
135,228 KB
testcase_24 AC 153 ms
135,752 KB
testcase_25 AC 150 ms
134,100 KB
testcase_26 AC 149 ms
135,260 KB
testcase_27 AC 69 ms
99,156 KB
testcase_28 AC 69 ms
99,208 KB
testcase_29 AC 68 ms
98,464 KB
testcase_30 AC 68 ms
98,804 KB
testcase_31 AC 100 ms
99,860 KB
testcase_32 AC 149 ms
133,304 KB
testcase_33 AC 101 ms
120,080 KB
testcase_34 AC 101 ms
119,656 KB
testcase_35 AC 73 ms
101,992 KB
testcase_36 AC 97 ms
109,576 KB
testcase_37 AC 103 ms
119,808 KB
testcase_38 AC 100 ms
119,632 KB
testcase_39 AC 80 ms
104,584 KB
testcase_40 AC 82 ms
105,064 KB
testcase_41 AC 136 ms
125,284 KB
testcase_42 AC 134 ms
125,292 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 not x:
    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