結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
👑 SPD_9X2
|
| 提出日時 | 2022-03-25 21:30:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 708 bytes |
| コンパイル時間 | 264 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 118,612 KB |
| 最終ジャッジ日時 | 2024-10-14 05:21:32 |
| 合計ジャッジ時間 | 6,189 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 WA * 2 |
ソースコード
import sys
from sys import stdin
import math
N = int(input())
A = list(map(int,input().split()))
A.sort()
d = None
z = 0
B = []
for i in range(N-1):
if A[i] != 0:
diff = A[i+1] - A[i]
if d == None:
d = diff
else:
d = math.gcd(d,diff)
else:
z += 1
for i in range(N):
if A[i] != 0:
B.append(A[i])
if len(B) == 0:
print ("Yes")
sys.exit()
if d == 0:
if max(B) == min(B):
print ("Yes")
else:
print ("No")
sys.exit()
ind = 0
for i in range(B[0],B[-1]+1,d):
if B[ind] == i:
ind += 1
else:
z -= 1
if z < 0:
print ("No")
sys.exit()
print ("Yes")
SPD_9X2