Submission #498327

#TimeUsernameProblemLanguageResultExecution timeMemory
498327kinglineSure Bet (CEOI17_sure)C++17
20 / 100
2077 ms204 KiB
/*#pragma GCC optimize("O3") #pragma GCC target ("avx2") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops")*/ #include <bits/stdc++.h> #pragma GCC optimize ("unroll-loops,Ofast,O3") #pragma GCC target("avx,avx2,fma") //#define file(data) freopen(data".in", "r", stdin); freopen(data".out", "w", stdout); #define pb push_back //#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define all(data) data.begin() , data.end() #define endl '\n' //freopen("nenokku_easy.in", "r", stdin); //freopen("nenokku_easy.out", "w", stdout); #define int long long #define pii pair < int, int > #define pll pair < long long, long long > using namespace std; typedef long long ll; const int N = 2e5 + 5; const int M = 305; const int mod = 1e9 + 7; int n; double a[N], b[N], ans; void reca(int pos, int cnt, double sum) { for(int mask = 0; mask < (1 << n); mask++) { double sum1 = 0; int cnt1 = 0; for(int i = 0; i < n; i++) { if((mask >> i) & 1) { sum1 += b[i + 1]; cnt1++; } } //cout << sum << " " << sum1 << " " << cnt << " " << cnt1 << endl; ans = max(ans, min(sum - cnt - cnt1, sum1 - cnt - cnt1)); } if(pos == n) return; reca(pos + 1, cnt + 1, sum + a[pos + 1]); reca(pos + 1, cnt, sum); } main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //file("pieaters"); cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i] >> b[i]; } reca(0, 0, 0); cout << fixed << setprecision(4) << ans; }

Compilation message (stderr)

sure.cpp:47:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   47 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...