結果
| 問題 |
No.3372 Suitable Constraint
|
| コンテスト | |
| ユーザー |
まぬお
|
| 提出日時 | 2025-11-21 21:28:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 150 ms / 2,000 ms |
| コード長 | 685 bytes |
| コンパイル時間 | 202 ms |
| コンパイル使用メモリ | 82,700 KB |
| 実行使用メモリ | 116,588 KB |
| 最終ジャッジ日時 | 2025-11-21 21:28:28 |
| 合計ジャッジ時間 | 3,463 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations
from heapq import heappop, heappush
import math, sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
_int = lambda x: int(x)-1
MOD = 998244353 #10**9+7
INF = 1<<60
Yes, No = "Yes", "No"
T = int(input())
for _ in range(T):
N = int(input())
A = list(map(int, input().split()))
p = []
n = []
for a in A:
if a <= 0: n.append(a)
else: p.append(a)
p.sort()
n.sort()
if len(n) == 0:
print(p[0]*p[-1])
elif len(p) == 0:
print(n[0]*n[-1])
else:
print(p[0]*n[-1])
まぬお