| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1368805 | JelaByteEngineer | Subset Mex (EGOI22_subsetmex) | C++20 | 34 ms | 344 KiB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t; cin>>t;
while (t--)
{
int n; cin>>n;
vector <ll> niz(n);
priority_queue <int, vector <int>, greater<int>> kju;
for (int i=0; i<n; i++)
{
cin>>niz[i];
if (niz[i]==0) kju.push(i);
}
ll cnt=0;
while (!kju.empty())
{
bool f=true;
for (auto i: niz)
{
if (i>1) f=false;
}
if (f) break;
int top=kju.top();
kju.pop();
niz[top]++;
for (int i=0; i<top; i++)
{
niz[i]--;
if (niz[i]==0) kju.push(i);
}
cnt++;
}
for (int i=0; i<n; i++)
{
if (niz[i]==0)
{
cnt+=(1<<i);
}
}
cout<<cnt+1<<endl;
}
return 0;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
