結果
| 問題 | No.3372 Suitable Constraint |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-27 16:28:13 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 810 bytes |
| コンパイル時間 | 3,069 ms |
| コンパイル使用メモリ | 284,784 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-11-27 16:28:21 |
| 合計ジャッジ時間 | 7,482 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(),(x).end()
template<class T> ll MIN(const vector<T>&a) { return *min_element(all(a)); }
template<class T> ll MAX(const vector<T>&a) { return *max_element(all(a)); }
int main() {
int tt;
cin >> tt;
while(tt--) {
int N;
cin >> N;
vector<int>A(N);
for(int i = 0; i < N; i++) cin >> A[i];
vector<int>POS,NEG;
bool f = false;
for(int i = 0; i < N; i++) {
if(A[i]==0)f=1;
else if(A[i]<0)NEG.push_back(A[i]);
else POS.push_back(A[i]);
}
vector<ll>th;
if(f)th.push_back(0);
if(NEG.size()&&POS.size())th.push_back(MIN(POS)*MAX(NEG));
if(POS.size()>=2) th.push_back(MIN(POS)*MAX(POS));
if(NEG.size()>=2) th.push_back(MIN(NEG)*MAX(NEG));
assert(!th.empty());
cout<<MIN(th)<<"\n";
}
}