Submission #878658

#TimeUsernameProblemLanguageResultExecution timeMemory
878658Jawad_Akbar_JJSure Bet (CEOI17_sure)C++14
0 / 100
1 ms2396 KiB
#include <iostream> #include <vector> #include <iomanip> using namespace std; #define ld long double const int N = 1e5 + 10; vector<int> v; ld a[N]; ld b[N]; int n; ld ans = 0; bool valid(int ind = n){ if (ind==0) return false; if (v[ind]<3){ v[ind]++; return true; } v[ind] = 0; return valid(ind-1); } void calculate(){ ld sum1 = 0,sum2 = 0; ld cnt = 0; for (int i=1;i<=n;i++) if (v[i]==1 or v[i]==3) sum1 += a[i],cnt++; else if (v[i]==2 or v[i]==3) sum2 += b[i],cnt++; ans = max(ans,min(sum1,sum2) - cnt); } signed main(){ cout<<fixed<<setprecision(4); cin>>n; for (int i=1;i<=n;i++) cin>>a[i]>>b[i]; for (int i=0;i<=n;i++) v.push_back(0); while (valid()){ calculate(); } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...