func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1086;   const int MAXT = 1586;   const long long R = 1000000;   struct query {     long long ts, tl;     long double ss, sl, p;     query() {}     query(long double _ss, long double _sl, long long _ts, long long _tl,           long double _p)         : ss(_ss), sl(_sl), ts(_ts), tl(_tl), p(_p) {}     void init() {       cin >> ss >> sl >> ts >> tl >> p;       ss *= R, sl *= R;     }   } Q[MAXN];   pair<long double, long double> dp[MAXN][MAXT];   inline bool cmp(const query &a, const query &b) {     return a.tl * (1 - b.p) * a.p < b.tl * (1 - a.p) * b.p;   }   void update(pair<long double, long double> &a,               pair<long double, long double> b) {     if (b.first > a.first || a.first == b.first && a.second > b.second) a = b;   }   int main() {     int i, j;     int m, n;     scanf( %d%d , &n, &m);     for (i = 0; i < n; ++i) Q[i].init();     sort(Q, Q + n, cmp);     for (i = 0; i < n; ++i)       for (j = 0; j <= m; ++j) dp[i][j].first = dp[i][j].second = -1;     dp[0][0].first = dp[0][0].second = 0;     for (i = 0; i < n; ++i) {       long long ts = Q[i].ts, tl = Q[i].tl;       long double ss = Q[i].ss, sl = Q[i].sl, p = Q[i].p;       for (j = 0; j <= m; ++j)         if (dp[i][j].first != -1) {           long double cs = dp[i][j].first, cp = dp[i][j].second;           update(dp[i + 1][j], dp[i][j]);           if (j + ts <= m)             update(dp[i + 1][j + ts],                    pair<long double, long double>(cs + ss, cp + ts));           if (j + ts + tl <= m)             update(dp[i + 1][j + ts + tl],                    pair<long double, long double>(                        cs + ss + (1 - p) * sl, ts + (j + tl) * (1 - p) + p * cp));         }     }     pair<long double, long double> res(0, 0);     for (i = 0; i <= m; ++i) update(res, dp[n][i]);     cout << setprecision(20) << res.first / R <<     << res.second << endl;     return 0;   }   