QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#118931#5455. TreeScriptxaphoenixRE 0ms0kbC++141.1kb2023-07-04 16:05:172023-07-04 16:05:21

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-04 16:05:21]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-07-04 16:05:17]
  • 提交

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

output:


result: