Submission #15328

# Submission time Handle Problem Language Result Execution time Memory
15328 2015-07-12T06:08:22 Z myungwoo 최적의 능력 구성 (kriii3_C) C++14
62 / 62
369 ms 9912 KB
#include <bits/stdc++.h>
using namespace std;

int N;
int P[20], Q[20];
double D[1 << 20];

int main()
{
	scanf("%d", &N);
	for (int i=0;i<N;i++) scanf("%d%d", P+i, Q+i);
	double ans = 0;
	for (int msk=1;msk<(1<<N);msk++){
		D[msk] = 0;
		int cnt = 0;
		for (int i=0;i<N;i++) if (msk & (1 << i)) cnt++;
		for (int i=0;i<N;i++) if (msk & (1 << i)){
			int nmsk = msk ^ (1 << i);
			D[msk] += (D[nmsk] * (100 - P[i]) / 100. + Q[i] * P[i] / 100.) / cnt;

		}
		ans = max(ans, D[msk]);
	}
	printf("%.12f\n", ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9912 KB Output is correct
2 Correct 0 ms 9912 KB Output is correct
3 Correct 0 ms 9912 KB Output is correct
4 Correct 0 ms 9912 KB Output is correct
5 Correct 0 ms 9912 KB Output is correct
6 Correct 0 ms 9912 KB Output is correct
7 Correct 0 ms 9912 KB Output is correct
8 Correct 0 ms 9912 KB Output is correct
9 Correct 0 ms 9912 KB Output is correct
10 Correct 0 ms 9912 KB Output is correct
11 Correct 0 ms 9912 KB Output is correct
12 Correct 0 ms 9912 KB Output is correct
13 Correct 0 ms 9912 KB Output is correct
14 Correct 0 ms 9912 KB Output is correct
15 Correct 0 ms 9912 KB Output is correct
16 Correct 0 ms 9912 KB Output is correct
17 Correct 0 ms 9912 KB Output is correct
18 Correct 0 ms 9912 KB Output is correct
19 Correct 0 ms 9912 KB Output is correct
20 Correct 0 ms 9912 KB Output is correct
21 Correct 0 ms 9912 KB Output is correct
22 Correct 0 ms 9912 KB Output is correct
23 Correct 0 ms 9912 KB Output is correct
24 Correct 0 ms 9912 KB Output is correct
25 Correct 0 ms 9912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 368 ms 9912 KB Output is correct
2 Correct 364 ms 9912 KB Output is correct
3 Correct 368 ms 9912 KB Output is correct
4 Correct 364 ms 9912 KB Output is correct
5 Correct 368 ms 9912 KB Output is correct
6 Correct 367 ms 9912 KB Output is correct
7 Correct 368 ms 9912 KB Output is correct
8 Correct 369 ms 9912 KB Output is correct
9 Correct 368 ms 9912 KB Output is correct
10 Correct 356 ms 9912 KB Output is correct
11 Correct 358 ms 9912 KB Output is correct
12 Correct 343 ms 9912 KB Output is correct
13 Correct 368 ms 9912 KB Output is correct
14 Correct 368 ms 9912 KB Output is correct
15 Correct 363 ms 9912 KB Output is correct
16 Correct 311 ms 9912 KB Output is correct
17 Correct 321 ms 9912 KB Output is correct
18 Correct 352 ms 9912 KB Output is correct
19 Correct 354 ms 9912 KB Output is correct
20 Correct 364 ms 9912 KB Output is correct