# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636408 | berr | Hindeks (COCI17_hindeks) | C++17 | 74 ms | 4180 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
int n; cin>>n;
vector<int> a(n);
for(int i=0; i<n; i++) cin>>a[i];
int h=0;
int s=0;
sort(a.begin(), a.end(), greater<int>());
for(int i=0; i<n; i++)
{
a[i]*=-1;
}
for(int i=31; i>=0; i--)
{
int tmp=s+(1LL<<i);
tmp*=-1;
int pos=upper_bound(a.begin(), a.end(), tmp)-a.begin()+1;
pos--;
tmp*=-1;
if(pos>=tmp) s=tmp;
}
cout<<s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |