結果
問題 | No.1884 Sequence |
ユーザー | U S |
提出日時 | 2022-03-25 21:38:18 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,241 bytes |
コンパイル時間 | 214 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 136,732 KB |
最終ジャッジ日時 | 2024-10-14 05:32:52 |
合計ジャッジ時間 | 7,313 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 64 ms
62,720 KB |
testcase_01 | AC | 59 ms
62,464 KB |
testcase_02 | AC | 59 ms
62,336 KB |
testcase_03 | AC | 57 ms
62,464 KB |
testcase_04 | RE | - |
testcase_05 | AC | 59 ms
62,592 KB |
testcase_06 | AC | 58 ms
62,592 KB |
testcase_07 | AC | 59 ms
62,336 KB |
testcase_08 | AC | 60 ms
62,336 KB |
testcase_09 | AC | 59 ms
62,336 KB |
testcase_10 | AC | 216 ms
136,320 KB |
testcase_11 | AC | 216 ms
136,384 KB |
testcase_12 | AC | 90 ms
94,976 KB |
testcase_13 | AC | 94 ms
98,560 KB |
testcase_14 | AC | 102 ms
98,688 KB |
testcase_15 | AC | 149 ms
116,336 KB |
testcase_16 | AC | 183 ms
136,468 KB |
testcase_17 | AC | 126 ms
106,580 KB |
testcase_18 | AC | 138 ms
118,376 KB |
testcase_19 | AC | 129 ms
109,868 KB |
testcase_20 | AC | 145 ms
111,476 KB |
testcase_21 | AC | 134 ms
104,184 KB |
testcase_22 | AC | 151 ms
113,648 KB |
testcase_23 | AC | 183 ms
136,336 KB |
testcase_24 | AC | 189 ms
136,732 KB |
testcase_25 | AC | 184 ms
136,072 KB |
testcase_26 | AC | 184 ms
136,036 KB |
testcase_27 | AC | 97 ms
102,016 KB |
testcase_28 | RE | - |
testcase_29 | AC | 99 ms
102,656 KB |
testcase_30 | AC | 100 ms
102,528 KB |
testcase_31 | AC | 140 ms
106,680 KB |
testcase_32 | AC | 179 ms
135,624 KB |
testcase_33 | AC | 150 ms
134,532 KB |
testcase_34 | AC | 149 ms
134,644 KB |
testcase_35 | AC | 110 ms
104,960 KB |
testcase_36 | AC | 138 ms
120,752 KB |
testcase_37 | AC | 152 ms
134,640 KB |
testcase_38 | AC | 147 ms
133,852 KB |
testcase_39 | AC | 122 ms
102,440 KB |
testcase_40 | AC | 125 ms
104,556 KB |
testcase_41 | AC | 169 ms
127,876 KB |
testcase_42 | AC | 171 ms
127,732 KB |
ソースコード
# import sys # input = sys.stdin.readline # import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') def mp():return map(int,input().split()) def lmp():return list(map(int,input().split())) def mps(A):return [tuple(map(int, input().split())) for _ in range(A)] def stoi(LIST):return list(map(int,LIST)) def itos(LIST):return list(map(str,LIST)) def bitA(X,A):return X & 1<<A == 1<<A import math import bisect import heapq import time from copy import copy as cc from copy import deepcopy as dc from itertools import accumulate, product from collections import Counter, defaultdict, deque def ceil(U,V):return (U+V-1)//V def modf1(N,MOD):return (N-1)%MOD+1 inf = int(1e18+20) mod = 998244353 from functools import reduce def gcd(numbers): return reduce(math.gcd, numbers) n = int(input()) a = lmp() ra = [] cz = 0 for i in a: if i != 0:ra.append(i) else:cz += 1 if not ra: print("Yes") exit() ra.sort() dif = [] for i in range(len(ra)-1): dif.append(ra[i+1]-ra[i]) if 0 in dif: f = True for i in dif: if i != 0:f = False if f:print("Yes") else: print("No") exit() gd = gcd(dif) cnt = 0 for i in dif: cnt += i//gd - 1 if cnt <= cz: print("Yes") else: print("No")