| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 41962 | 黄子睿 | 【S】T3 | C++ | 通过 | 100 | 576 MS | 5452 KB | 1114 | 2026-06-06 14:39:00 |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 114.5e4; set<ll> myset, tmp, tmptmp; int n, a[N]; ll lcm(ll x, ll j) { return x * j / __gcd(x, j); } int main() { ios ::sync_with_stdio(0); cin.tie(0), cout.tie(0); int T; cin >> T; while (T--) { cin >> n; myset.clear(); tmp.clear(); for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= n; i++) { tmptmp.clear(); if(a[i]-1){ for (auto j : tmp) { ll tt = lcm(j, a[i]); if (tt < 5e6) { tmptmp.insert(tt); } } }else{ swap(tmptmp,tmp); } tmptmp.insert(a[i]); tmp.clear(); for (auto j : tmptmp) { tmp.insert(j); myset.insert(j); } } int ans = 1; for (; myset.count(ans); ans++) ; cout << ans << '\n'; } return 0; }