This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> p(N), d(N);
for (int i=0; i<N; i++)
cin >> p[i] >> d[i];
vector<double> res(1<<N);
double ret = 0.0;
for (int i=1; i<(1<<N); i++) {
int cnt = 0;
double sum = 0.0;
for (int j=0; j<N; j++) {
if (i&(1<<j)) {
sum += 0.01 * p[j] * d[j] + (1.0 - 0.01 * p[j]) * res[i-(1<<j)];
cnt ++;
}
}
res[i] = sum / cnt;
ret = max(ret, res[i]);
}
cout << setprecision(15) << ret << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |