QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#118931 | #5455. TreeScript | xaphoenix | RE | 0ms | 0kb | C++14 | 1.1kb | 2023-07-04 16:05:17 | 2023-07-04 16:05:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define LC k << 1
#define RC k << 1 | 1
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repn(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pern(i, a, n) for (int i = n; i >= a; i--)
typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
const int N = 210000;
const int M = 1100000;
const int mod = 1e9 + 7;
const int inf = 1e9;
const double eps = 1e-9;
int T, n, a[N], b[N];
int main() {
IO;
cin >> T;
while (T--) {
cin >> n;
int m1 = 1e9, m2 = 1e9;
repn(i, 1, n) {
cin >> a[i];
m1 = min(m1, a[i]);
m2 = min(m2, (a[i] - 1) / 2);
}
bool y1 = true;
repn(i, 1, n) {
if (a[i] % m1 != 0 && (a[i] - 1) / 2 < m1) y1 = false;
}
if (y1) cout << m1 <<"\n";
else cout << m2 << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
2 3 0 1 2 7 0 1 2 2 1 4 1