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>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ii pair<int,int>
template <class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int nax=1e5+5;
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
optimise;
int n;
cin>>n;
vector<double> tab(n*2);
for (int i = 0; i < n; ++i)
{
cin>>tab[i]>>tab[n+i];
}
double ans=0;
for (int mask = 0; mask < (1<<(2*n)); ++mask)
{
double cnt=0;
for (int i = 0; i < n; ++i)
{
if((1<<i)&mask){
cnt+=tab[i];
}
}
cnt-=(int)__builtin_popcount(mask);
ans=max(ans,cnt);
}
cout <<fixed<<setprecision(4)<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |