QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#34179 | #4230. Leaderboard Effect | Heltion# | AC ✓ | 1357ms | 212824kb | C++20 | 1.5kb | 2022-06-05 22:09:12 | 2022-06-05 22:09:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LD = long double;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, t;
cin >> n >> t;
vector<int> r(n), c(n);
vector<LD> p(n);
for (int i = 0; i < n; i += 1) cin >> r[i] >> c[i] >> p[i];
vector f(t + 1, vector<LD>(n));
vector g(t + 1, vector<LD>(1 << n));
g[0][(1 << n) - 1] = 1;
for (int i = 0; i < t; i += 1) {
for (int j = 0; j < n; j += 1)
f[i + 1][j] += f[i][j];
for (int j = 0; j < (1 << n); j += 1)
if (g[i][j]) {
LD fm = 0, ct = 0;
for (int k = 0; k < n; k += 1)
if ((j >> k) & 1) {
fm += f[i][k];
ct += 1;
}
for (int k = 0; k < n; k += 1)
if ((j >> k) & 1) {
LD pr = fm ? f[i][k] / fm : 1 / ct;
if (pr) {
if (i + r[k] <= t)
g[i + r[k]][j ^ (1 << k)] += g[i][j] * pr * (1 - p[k]);
if (i + r[k] + c[k] <= t) {
f[i + r[k] + c[k]][k] += g[i][j] * pr * p[k];
g[i + r[k] + c[k]][j ^ (1 << k)] += g[i][j] * pr * p[k];
}
}
}
}
}
for (auto fi : f[t]) cout << fixed << setprecision(20) << fi << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3856kb
input:
4 42 10 10 0.75 10 10 0.75 10 12 1 10 12 1
output:
0.45625000000000000001 0.45625000000000000001 0.29687500000000000000 0.29687500000000000000
result:
ok 4 numbers
Test #2:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
4 42 10 12 0.75 10 12 0.75 10 10 1 10 10 1
output:
0.20312500000000000000 0.20312500000000000000 0.68323863636363636363 0.68323863636363636363
result:
ok 4 numbers
Test #3:
score: 0
Accepted
time: 2ms
memory: 3824kb
input:
5 100 40 60 0.6 40 61 1 10 40 0.3 10 40 0.4 10 40 0.5
output:
0.12000000000000000000 0.00000000000000000000 0.11262857142857142859 0.15973968253968253969 0.20644444444444444444
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 264ms
memory: 55944kb
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.54668836009203605134 0.05551901824213992261 0.39362139111512301653 0.35087491975478210963 0.66742440911959154625 0.57122251293715968452 0.79995221661243068366 0.04000540433893953527 0.00614504871959888833 0.55125623184380997949 0.29998903303469590234 0.39126058327480315194 0.76047492422599132210 0...
result:
ok 15 numbers
Test #5:
score: 0
Accepted
time: 613ms
memory: 108092kb
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.08588048070492942615 0.42529273154636671055 0.93741115213716640330 0.09222495699047236765 0.43399593846182311582 0.07552292684403203415 0.17343079640767914581 0.10175299658552264837 0.53493333931145085457 0.76513888617242374423 0.40857003079337223106 0.00023454518291695144 0.83749109875028283196 0...
result:
ok 16 numbers
Test #6:
score: 0
Accepted
time: 62ms
memory: 108096kb
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.02241736441437572776 0.00067198746859231575 0.18813400452602550203 0.26740219606238851459 0.00080645224944633292 0.48120717281425315297 0.00150862400681100832 0.72890064007684276349 0.09353024688396185707 0.01441575388489400798 0.10047945221036762319 0.00790530034466072124 0.01610834593573616258 0...
result:
ok 16 numbers
Test #7:
score: 0
Accepted
time: 2ms
memory: 3724kb
input:
2 100 44 23 0.344489870631275 18 13 0.617983603136949
output:
0.34448987063127500000 0.61798360313694899998
result:
ok 2 numbers
Test #8:
score: 0
Accepted
time: 1357ms
memory: 212612kb
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.60972059866033335909 0.06641629090845206544 0.27596479348733367313 0.01163166615201631805 0.26539687385289337137 0.92761872472416292252 0.11045245334090534405 0.90002284130407104621 0.27245477747470554927 0.54441906435362974145 0.80755700962378858785 0.78743827523542380287 0.42419747795768168280 0...
result:
ok 17 numbers
Test #9:
score: 0
Accepted
time: 771ms
memory: 181740kb
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.58672451925085352726 0.91295342093797276882 0.00658061685952919117 0.42105608679299637116 0.46074979157654574486 0.03150303854214339347 0.74982986241219045813 0.24689805555974362191 0.74161588587362550074 0.00871655850178168931 0.63433833796624744533 0.59940764444686041724 0.03096626434331925797 0...
result:
ok 17 numbers
Test #10:
score: 0
Accepted
time: 757ms
memory: 181844kb
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.00549407678748756448 0.03723779887460487808 0.62943725336130418427 0.00354346585554060407 0.78102352796223358563 0.67715793995596022873 0.41080643346000578306 0.00374388324681877436 0.64244092963195119085 0.01655332319516672380 0.30380512333644084746 0.42383167702539645651 0.08619828728229880609 0...
result:
ok 17 numbers
Test #11:
score: 0
Accepted
time: 848ms
memory: 181752kb
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.02711503392991635562 0.79243715603432841762 0.20619677812333994457 0.02044318433790967314 0.79747439340083091158 0.42687880971313619139 0.28520394599287391473 0.55188337881167394406 0.79282214039892287669 0.08161989315021482071 0.49829325401456582209 0.00412195807433574443 0.64301075041209664740 0...
result:
ok 17 numbers
Test #12:
score: 0
Accepted
time: 737ms
memory: 181992kb
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.39728912747579149382 0.76142213097162264292 0.83152020440142030609 0.78082779802580722794 0.19624488892875799776 0.25409023598682602748 0.19070461213892969104 0.70361578620250506068 0.68028081591440285505 0.03555314122570714190 0.00259538940010823550 0.21120365882171380756 0.00395478562594186420 0...
result:
ok 17 numbers
Test #13:
score: 0
Accepted
time: 39ms
memory: 212636kb
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.07155790503019076151 0.00853195111739396568 0.03578150533929467923 0.05741746624954843057 0.00000000000000000000 0.00000000000000000000 0.02657795506103088235 0.00000000000000000000 0.00000000000000000000 0.07617775492646394234 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0...
result:
ok 17 numbers
Test #14:
score: 0
Accepted
time: 57ms
memory: 212824kb
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.00000000000000000000 0.00000000000000000000 0.06028281441406229047 0.00000000000000000000 0.04155354455217949851 0.00000000000000000000 0.05264228817170953664 0.01116549044863773569 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.04266142811268726464 0.00000000000000000000 0...
result:
ok 17 numbers
Test #15:
score: 0
Accepted
time: 2ms
memory: 3820kb
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.53849999999999999993 0.37649999999999999998 0.24150000000000000000 0.23850000000000000000 0.23850000000000000000
result:
ok 5 numbers