Submission #1033185

#TimeUsernameProblemLanguageResultExecution timeMemory
1033185MarwenElarbiSure Bet (CEOI17_sure)C++17
0 / 100
1 ms348 KiB
#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<pair<double,double>> tab(n); for (int i = 0; i < n; ++i) { cin>>tab[i].fi>>tab[i].se; } double ans=0; for (int mask = 0; mask < (1<<n); ++mask) { vector<pair<double,double>> cur; for (int i = 0; i < n; ++i) { if((1<<i)&mask){ cur.pb(tab[i]); } for (int s = 0; s < (1<<cur.size()); ++s) { pair<double,double> cnt={0,0}; for (int j = 0; j < (int)(cur.size()); ++j) { if((1<<j)&s) cnt.fi+=cur[j].fi; else cnt.se+=cur[j].se; } cnt.fi-=(int)cur.size(); cnt.se-=(int)cur.size(); ans=max(ans,min(cnt.fi,cnt.se)); } } } cout <<fixed<<setprecision(4)<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...