QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#61413 | #4230. Leaderboard Effect | 2pal1rak# | AC ✓ | 2354ms | 276228kb | C++14 | 1.8kb | 2022-11-12 22:17:10 | 2022-11-12 22:17:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MaxTime = 302, MaxMask = (1<<17) + 2;
struct problem
{
int read, code;
double prob;
} a[20];
int n, lim_time;
double solved[MaxTime][20];
double dp[MaxTime][MaxMask];
inline void go_to(double &x, double y)
{
x += y;
}
int main()
{
// freopen("input", "r", stdin);
cin.sync_with_stdio(false); cin.tie(0);
cout << setprecision(6) << fixed;
cin >> n >> lim_time;
int unread, t, p;
for(int i=0; i<n; ++i)
cin >> a[i].read >> a[i].code >> a[i].prob;
dp[0][(1<<n) - 1] = 1; // all unread
for(t=0; t<=lim_time; ++t)
{
if(t)
{
for(p=0; p<n; ++p)
solved[t][p] += solved[t-1][p];
}
for(unread = 0; unread < (1<<n); ++unread)
{
double total_solved = 0;
for(p = 0; p < n; ++p)
if(unread & (1<<p))
total_solved += solved[t][p];
for(p = 0; p < n; ++p)
if(unread & (1<<p))
{
double choose_p;
if(total_solved > 0)
choose_p = solved[t][p] / total_solved;
else choose_p = (double) 1 / __builtin_popcount(unread);
go_to(dp[t+a[p].read][unread ^ (1<<p)], dp[t][unread] * choose_p * (1 - a[p].prob));
go_to(dp[t+a[p].read+a[p].code][unread ^ (1<<p)], dp[t][unread] * choose_p * a[p].prob);
go_to(solved[t+a[p].read+a[p].code][p], dp[t][unread] * choose_p * a[p].prob);
}
}
}
for(p=0; p<n; ++p)
cout << solved[lim_time][p] << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 3764kb
input:
4 42 10 10 0.75 10 10 0.75 10 12 1 10 12 1
output:
0.456250 0.456250 0.296875 0.296875
result:
ok 4 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 3944kb
input:
4 42 10 12 0.75 10 12 0.75 10 10 1 10 10 1
output:
0.203125 0.203125 0.683239 0.683239
result:
ok 4 numbers
Test #3:
score: 0
Accepted
time: 4ms
memory: 4448kb
input:
5 100 40 60 0.6 40 61 1 10 40 0.3 10 40 0.4 10 40 0.5
output:
0.120000 0.000000 0.112629 0.159740 0.206444
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 415ms
memory: 36444kb
input:
15 100 4 14 0.954205412740471 5 11 0.264054003774017 1 7 0.521673865442381 3 12 0.6756938980261 1 15 0.980129050876819 2 12 0.836645892885326 10 3 0.959863273940343 13 6 0.230786407526669 3 13 0.0575791282076707 6 5 0.706328060881614 1 15 0.662404274712202 2 13 0.715327416279894 11 2 0.9275847467499...
output:
0.546688 0.055519 0.393621 0.350875 0.667424 0.571223 0.799952 0.040005 0.006145 0.551256 0.299989 0.391261 0.760475 0.518805 0.071749
result:
ok 15 numbers
Test #5:
score: 0
Accepted
time: 826ms
memory: 63716kb
input:
16 100 1 8 0.203833126785817 1 10 0.551151943064124 1 12 0.996220861387656 1 7 0.198656409543208 2 2 0.467994369421028 8 3 0.201277956430612 1 10 0.33397726300295 1 8 0.223430703554389 3 12 0.715363922664928 9 6 0.883743052774488 1 9 0.51636293824285 2 7 0.00210327442137626 6 11 0.978989778915285 1 ...
output:
0.085880 0.425293 0.937411 0.092225 0.433996 0.075523 0.173431 0.101753 0.534933 0.765139 0.408570 0.000235 0.837491 0.150633 0.889199 0.776051
result:
ok 16 numbers
Test #6:
score: 0
Accepted
time: 929ms
memory: 88880kb
input:
16 100 36 30 0.246284470931766 40 2 0.00729886464249319 34 9 0.969806174971755 2 27 0.700168809611093 2 49 0.00964738878291982 11 13 0.843818712396597 23 15 0.015695164745825 2 11 0.860911871987035 8 39 0.759047449661107 33 17 0.156016479857797 5 40 0.704380590007194 2 36 0.0742940485679995 13 17 0....
output:
0.022417 0.000672 0.188134 0.267402 0.000806 0.481207 0.001509 0.728901 0.093530 0.014416 0.100479 0.007905 0.016108 0.011464 0.193442 0.108541
result:
ok 16 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 4196kb
input:
2 100 44 23 0.344489870631275 18 13 0.617983603136949
output:
0.344490 0.617984
result:
ok 2 numbers
Test #8:
score: 0
Accepted
time: 1917ms
memory: 125024kb
input:
17 100 1 6 0.618966248907732 1 6 0.126915204708293 4 7 0.35153234988752 2 3 0.0368548187261588 1 5 0.299571483949073 1 12 0.944530094804986 3 12 0.249408160616937 1 11 0.91317090384857 5 8 0.377638681694897 4 12 0.639080155811651 1 4 0.809300766237897 8 5 0.812731204986182 1 10 0.480107932016118 7 1...
output:
0.609721 0.066416 0.275965 0.011632 0.265397 0.927619 0.110452 0.900023 0.272455 0.544419 0.807557 0.787438 0.424197 0.453290 0.071089 0.023051 0.276631
result:
ok 17 numbers
Test #9:
score: 0
Accepted
time: 1605ms
memory: 109616kb
input:
17 85 8 6 0.9977 1 4 0.9459 5 9 0.0733 2 9 0.759 9 6 0.921 5 6 0.2015 2 8 0.9407 8 10 0.7806 5 3 0.864 4 4 0.0777 9 3 0.9518 8 2 0.8221 10 9 0.2471 4 8 0.4679 7 6 0.603 3 2 0.4067 5 5 0.8879
output:
0.586725 0.912953 0.006581 0.421056 0.460750 0.031503 0.749830 0.246898 0.741616 0.008717 0.634338 0.599408 0.030966 0.141902 0.226289 0.285203 0.681216
result:
ok 17 numbers
Test #10:
score: 0
Accepted
time: 1529ms
memory: 108212kb
input:
17 85 9 7 0.0563 7 7 0.1979 9 3 0.7689 1 6 0.0291 7 7 0.9631 5 8 0.847 8 6 0.6752 2 9 0.0396 4 2 0.6747 8 3 0.1071 8 4 0.5134 9 7 0.7491 6 8 0.3134 3 1 0.8355 4 5 0.5561 1 10 0.372 9 9 0.4515
output:
0.005494 0.037238 0.629437 0.003543 0.781024 0.677158 0.410806 0.003744 0.642441 0.016553 0.303805 0.423832 0.086198 0.826971 0.461285 0.163761 0.128595
result:
ok 17 numbers
Test #11:
score: 0
Accepted
time: 1520ms
memory: 107108kb
input:
17 85 1 7 0.1344 5 8 0.99 8 3 0.437 4 9 0.1375 3 2 0.8208 1 8 0.5922 10 6 0.655 8 5 0.8043 2 5 0.8447 5 10 0.3305 9 3 0.725 1 8 0.0394 6 5 0.8091 8 7 0.6427 9 6 0.7282 4 7 0.1024 1 6 0.4222
output:
0.027115 0.792437 0.206197 0.020443 0.797474 0.426879 0.285204 0.551883 0.792822 0.081620 0.498293 0.004122 0.643011 0.299258 0.386625 0.014475 0.270608
result:
ok 17 numbers
Test #12:
score: 0
Accepted
time: 1609ms
memory: 108732kb
input:
17 85 10 2 0.6556 3 1 0.7738 1 8 0.9047 3 10 0.9973 10 4 0.5266 8 1 0.4384 5 3 0.3559 3 6 0.7999 8 6 0.9665 3 4 0.142 7 5 0.0319 6 3 0.4056 6 10 0.0477 8 10 0.1334 5 8 0.8102 8 8 0.6 7 5 0.318
output:
0.397289 0.761422 0.831520 0.780828 0.196245 0.254090 0.190705 0.703616 0.680281 0.035553 0.002595 0.211204 0.003955 0.014426 0.529030 0.218261 0.087684
result:
ok 17 numbers
Test #13:
score: 0
Accepted
time: 2354ms
memory: 272616kb
input:
17 100 10 41 0.986344070444954 38 40 0.13596976314146 23 65 0.589188420670698 23 41 0.862487981086339 66 62 0.756039635351495 84 82 0.466671597793749 17 74 0.451825236037525 97 49 0.785964886639839 76 26 0.432545432217108 10 33 0.495053202758143 35 72 0.437261903429889 55 95 0.333190022475783 83 56 ...
output:
0.071558 0.008532 0.035782 0.057417 0.000000 0.000000 0.026578 0.000000 0.000000 0.076178 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
result:
ok 17 numbers
Test #14:
score: 0
Accepted
time: 2134ms
memory: 276228kb
input:
17 100 52 66 0.608312285077897 77 36 0.182402129968963 43 16 0.906840075497175 75 100 0.508033408075313 25 60 0.688919263266595 84 59 0.17045120790047 75 9 0.831462171228754 16 69 0.185113485186001 71 54 0.372346884200038 90 65 0.235248490382517 62 50 0.917089563798644 47 45 0.717838729472597 56 51 ...
output:
0.000000 0.000000 0.060283 0.000000 0.041554 0.000000 0.052642 0.011165 0.000000 0.000000 0.000000 0.042661 0.000000 0.045098 0.000000 0.039767 0.056075
result:
ok 17 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
5 40 10 8 0.9 10 9 0.9 10 10 0.9 10 11 0.9 10 12 0.9
output:
0.538500 0.376500 0.241500 0.238500 0.238500
result:
ok 5 numbers