Accepted
Code
#include <bits/stdc++.h>
#define ll long long
#define pub push_back
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
void solve()
{
ll n;
cin >> n;
ll s = 0;
for (ll i = 1; i <= n; i++)
{
int x;
cin >> x;
s += x;
}
ll i;
for (i = 1;; i++)
{
if (s >= i)
{
s -= i;
}
else
{
break;
}
}
cout << i << endl;
}
int main()
{
fast;
ll t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1114 Maximize the MEX
- Contest
- Brain Booster #7
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-11-05 15:54:48
- Judged At
- 2024-11-11 02:29:23
- Judged By
- Score
- 100
- Total Time
- 35ms
- Peak Memory
- 584.0 KiB