func_code_string: #include <bits/stdc++.h>   using namespace std;   double pa[2020], pb[2020], pab[2020];   int n, a, b;   double dp[2020];   int opt[2020];   pair<int, int> solve(double mida, double midb) {     dp[0] = 0;     opt[0] = 0;     for (int i = 1; i <= n; i++) {       double& d = dp[i];       int& o = opt[i];       d = dp[i - 1];       o = 0;       if (d < dp[i - 1] + pa[i] - mida) {         d = dp[i - 1] + pa[i] - mida;         o = 1;       }       if (d < dp[i - 1] + pb[i] - midb) {         d = dp[i - 1] + pb[i] - midb;         o = 2;       }       if (d < dp[i - 1] + pab[i] - mida - midb) {         d = dp[i - 1] + pab[i] - mida - midb;         o = 3;       }     }     pair<int, int> ans = make_pair(0, 0);     for (int i = 1; i <= n; i++) {       if (opt[i] & 1) {         ans.first++;       }       if (opt[i] > 1) {         ans.second++;       }     }     return ans;   }   int main() {     scanf( %d %d %d , &n, &a, &b);     for (int i = 1; i <= n; i++) {       scanf( %lf , &pa[i]);     }     for (int i = 1; i <= n; i++) {       scanf( %lf , &pb[i]);     }     for (int i = 1; i <= n; i++) {       pab[i] = pa[i] + pb[i] - pa[i] * pb[i];     }     double lowa = 0, higha = 1;     double lowb = 0, highb = 1;     for (int it = 0; it < 100; it++) {       double mida = (lowa + higha) / 2;       lowb = 0;       highb = 1;       for (int itb = 0; itb < 100; itb++) {         double midb = (lowb + highb) / 2;         auto ans = solve(mida, midb);         if (ans.second > b) {           lowb = midb;         } else {           highb = midb;         }       }       auto ans = solve(mida, highb);       if (ans.first > a) {         lowa = mida;       } else {         higha = mida;       }     }     auto ret = solve(higha, highb);     printf( %.10lf n , dp[n] + lowa * a + lowb * b);     return 0;   }   