結果
| 問題 | No.3531 Erase Pair |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-05-04 23:31:58 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,171 bytes |
| 記録 | |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 85,792 KB |
| 実行使用メモリ | 83,596 KB |
| 最終ジャッジ日時 | 2026-05-04 23:32:09 |
| 合計ジャッジ時間 | 6,785 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 50 |
ソースコード
from sys import stdin
input = stdin.readline
from math import gcd
# from F_test import solve
def func(B):
cnt = 0
if len(B)%2 == 0:
return True
for i in range(len(B)):
if i+1 < len(B) and B[i]+2 <= B[i+1]:
return True
if B[i] == 1: cnt += 1
return cnt <= len(B)-cnt
from random import randrange
for _ in range(int(input())):
N = int(input())
A = list(map(int, input().split()))
# N = randrange(1, 8)
# A = [randrange(-100, 101) for _ in range(N)]
# res = solve(A)
# if res: continue
#print(f"愚直解: {"Yes" if res else "No"}")
L, R = [], []
cnt = 0
GCD = 0
for a in A:
GCD = gcd(GCD, abs(a))
if a < 0:
L.append(-a)
elif a == 0:
cnt += 1
else:
R.append(a)
L.sort()
R.sort()
for i in range(len(L)):
L[i] //= GCD
for i in range(len(R)):
R[i] //= GCD
if 2 <= cnt or N%2 == 0 and cnt == 1:
print("No")
continue
if cnt == 0:
print("Yes")
continue
if not func(L) and not func(R):
print("No")
else:
print("Yes")
detteiuu