QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#548315 | #4683. Qanat | PhantomThreshold# | AC ✓ | 3ms | 20396kb | C++20 | 1.9kb | 2024-09-05 17:04:58 | 2024-09-05 17:04:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long double db;
const int maxn=1000;
db w,h;
int n;
db a[maxn+50][maxn+50];
db x[maxn+50];
int main(){
ios_base::sync_with_stdio(false);
cin >> w >> h >> n;
for (int i=1;i<=n;i++){
if (i>1) a[i][i-1]=h*h-w*w;
a[i][i]=2*w*w;
if (i<n) a[i][i+1]=h*h-w*w;
if (i==n) a[i][n+1]=w*w-h*h;
}
// cerr << "----------------------" << endl;
// for (int i=1;i<=n;i++){
// for (int j=1;j<=n+1;j++){
// cerr << a[i][j] << " ";
// }
// cerr << endl;
// }
// cerr << "----------------------" << endl;
for (int i=1;i<n;i++){
db t=a[i+1][i]/a[i][i];
a[i+1][i]=0;
a[i+1][i+1]-=t*a[i][i+1];
a[i+1][n+1]-=t*a[i][n+1];
}
// cerr << "----------------------" << endl;
// for (int i=1;i<=n;i++){
// for (int j=1;j<=n+1;j++){
// cerr << a[i][j] << " ";
// }
// cerr << endl;
// }
// cerr << "----------------------" << endl;
for (int i=n;i>=2;i--){
db t=a[i-1][i]/a[i][i];
a[i-1][i]=0;
a[i-1][n+1]-=t*a[i][n+1];
}
// cerr << "----------------------" << endl;
// for (int i=1;i<=n;i++){
// for (int j=1;j<=n+1;j++){
// cerr << a[i][j] << " ";
// }
// cerr << endl;
// }
// cerr << "----------------------" << endl;
x[0]=0;
x[n+1]=1;
for (int i=1;i<=n;i++) x[i]=a[i][n+1]/a[i][i];
db ans=0;
for (int i=1;i<=n+1;i++){
db tmp=((x[i]+x[i-1])*h+(x[i]-x[i-1])*w)/2;
ans=ans+tmp*tmp;
db tmp2=x[i]*h;
if (i<=n) ans=ans-0.5*tmp2*tmp2;
}
cout << fixed << setprecision(12);
cout << ans << "\n";
for (int i=1;i<=n && i<=10;i++){
cout << x[i]*w << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3884kb
input:
8 4 1
output:
31.500000000000 3.000000000000
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
195 65 2
output:
12220.000000000000 48.000000000000 108.000000000000
result:
ok 3 numbers
Test #3:
score: 0
Accepted
time: 3ms
memory: 18952kb
input:
10000 1 1000
output:
30141.885677128479 9.956721203095 19.913442605324 29.870164405822 39.826886803724 49.783609998163 59.740334188275 69.697059573193 79.653786352052 89.610514723987 99.567244888132
result:
ok 11 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
2 1 5
output:
1.911532555283 0.029852579853 0.079606879607 0.182432432432 0.406879606880 0.902579852580
result:
ok 6 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
10000 9999 1
output:
99989999.750049998758 0.999950000000
result:
ok 2 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
10000 1 1
output:
12505000.499999998750 4999.999950000000
result:
ok 2 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 12888kb
input:
10000 51 500
output:
436223.562530668613 3.891507613976 7.783217669444 11.675332618426 15.568054934008 19.461587120873 23.356131725833 27.251891348368 31.149068651165 35.047866370660 38.948487327586
result:
ok 11 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 12176kb
input:
10000 185 500
output:
1587574.056021334231 0.001060330439 0.002121386922 0.003183895992 0.004248585185 0.005316183530 0.006387422049 0.007463034255 0.008543756656 0.009630329262 0.010723496084
result:
ok 11 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
1000 995 2
output:
994993.812112480605 0.024875775039 4.987624067928
result:
ok 3 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
10000 1 9
output:
2505001.899999780550 999.999670000074 1999.999360000141 2999.999090000197 3999.998880000234 4999.998750000250 5999.998720000242 6999.998810000209 7999.999040000155 8999.999430000082
result:
ok 10 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
10000 1 10
output:
2277729.340908798182 909.090545454645 1818.181109091101 2727.271709091179 3636.362363636692 4545.453090909453 5454.543909091277 6363.634836363980 7272.725890909381 8181.817090909301 9090.908454545565
result:
ok 11 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
10000 1 11
output:
2088335.569444063773 833.332936111241 1666.665888889141 2499.998875000359 3333.331911111554 4166.665013889389 4999.998200000525 5833.331486111626 6666.664888889358 7499.998425000389 8333.332111111389
result:
ok 11 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 18480kb
input:
5374 23 881
output:
105634.972481495298 0.312477922020 0.624967291724 0.937479557216 1.250026167437 1.562618572589 1.875268224549 2.187986577294 2.500785087315 2.813675214041 3.126668420258
result:
ok 11 numbers
Test #14:
score: 0
Accepted
time: 1ms
memory: 6200kb
input:
7868 6 86
output:
202023.774414224673 90.304245826747 180.608596683216 270.913157599251 361.218033604942 451.523329730742 541.829151007596 632.135602467058 722.442789141417 812.750816063813 903.059788268367
result:
ok 11 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 13092kb
input:
458 4 583
output:
1567.698163276308 0.008335238902 0.016671749462 0.025010803531 0.033353673349 0.041701631738 0.050055952296 0.058417909591 0.066788779359 0.075169838691 0.083562366237
result:
ok 11 numbers
Test #16:
score: 0
Accepted
time: 3ms
memory: 16800kb
input:
948 7 778
output:
5676.398722771738 0.005803904099 0.011608441125 0.017414244074 0.023221946077 0.029032180478 0.034845580891 0.040662781280 0.046484416021 0.052311119974 0.058143528552
result:
ok 11 numbers
Test #17:
score: 0
Accepted
time: 2ms
memory: 10380kb
input:
5964 32 326
output:
164105.039431878682 7.623164747942 15.246768433188 22.871250018314 30.497048516448 38.124603016542 45.754352708660 53.386736909261 61.022195086501 68.661166885531 76.304092153815
result:
ok 11 numbers
Test #18:
score: 0
Accepted
time: 1ms
memory: 6344kb
input:
9810 46 137
output:
446648.137669328962 62.055733988697 124.114196949585 186.178117974866 248.250226396767 310.333251907564 372.429924679624 434.542975485469 496.675135817864 558.829138009938 621.007715355338
result:
ok 11 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 18692kb
input:
5506 26 889
output:
122360.703323669450 0.192875062238 0.385758726290 0.578659594354 0.771586269393 0.964547355524 1.157551458398 1.350607185582 1.543723146949 1.736907955055 1.930170225528
result:
ok 11 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 10732kb
input:
2274 11 359
output:
21510.311268191569 2.670186390476 5.340497745317 8.011059034735 10.681995240641 13.353431362491 16.025492423137 18.698303474676 21.371989604309 24.046675940188 26.722487657272
result:
ok 11 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 14692kb
input:
709 3 571
output:
1819.356662319423 0.277079688733 0.554169299313 0.831278753941 1.108417975530 1.385596888057 1.662825416923 1.940113489303 2.217471034506 2.494907984328 2.772434273408
result:
ok 11 numbers
Test #22:
score: 0
Accepted
time: 1ms
memory: 6412kb
input:
8601 87 124
output:
655817.085460414150 42.346699773365 84.702065864567 127.074766365018 169.473472913643 211.906862471546 254.383619097763 296.912435726467 339.502015945993 382.161075780036 424.898345471405
result:
ok 11 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 16692kb
input:
3207 2 638
output:
7649.049651907127 4.762635959785 9.525275624156 14.287922697700 19.050580885013 23.813253890696 28.575945419365 33.338659175647 38.101398864190 42.864168189658 47.626970856742
result:
ok 11 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2971 24 28
output:
114650.014744811556 100.599972348003 201.213074957577 301.852439804048 402.531202290479 503.262502962092 604.059489221370 704.935317044048 805.903152696225 906.976174452820 1008.167574317592
result:
ok 11 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 18740kb
input:
8420 73 940
output:
525973.293386903537 0.002013818859 0.004027940482 0.006042667679 0.008058303351 0.010075150535 0.012093512451 0.014113692546 0.016135994540 0.018160722474 0.020188180751
result:
ok 11 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 20316kb
input:
6704 50 943
output:
286734.448995275809 0.006702204267 0.013405154199 0.020109595544 0.026816274216 0.033525936378 0.040239328525 0.046957197567 0.053680290911 0.060409356547 0.067145143129
result:
ok 11 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 20396kb
input:
4495 24 999
output:
92225.089019317849 0.035680333889 0.071362702168 0.107049139345 0.142741680159 0.178442359695 0.214153213506 0.249876277721 0.285613589168 0.321367185487 0.357139105245
result:
ok 11 numbers
Test #28:
score: 0
Accepted
time: 3ms
memory: 18632kb
input:
9270 32 846
output:
253507.499227001827 1.448844802490 2.897724135055 4.346672528594 5.795724515651 7.244914631239 8.694277413664 10.143847405345 11.593659153641 13.043747211673 14.494146139146
result:
ok 11 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 16636kb
input:
9865 74 778
output:
624467.914169742234 0.053917277843 0.107840623771 0.161776106552 0.215729796319 0.269707765256 0.323716088278 0.377760843717 0.431848114003 0.485983986355 0.540174553458
result:
ok 11 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 16548kb
input:
6422 52 782
output:
285713.102058474803 0.018770669336 0.037543800197 0.056321854432 0.075107294534 0.093902583966 0.112710187481 0.131532571449 0.150372204176 0.169231556232 0.188113100771
result:
ok 11 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 12552kb
input:
3730 1 509
output:
8770.087570166318 7.268347283923 14.536695612681 21.805046031112 29.073399584050 36.341757316332 43.610120272797 50.878489498282 58.146866037625 65.415250935667 72.683645237249
result:
ok 11 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 14900kb
input:
7689 70 720
output:
460629.101736604580 0.018410564801 0.036824181637 0.055243903048 0.073672782587 0.092113875325 0.110570238357 0.129044931310 0.147541016849 0.166061561188 0.184609634592
result:
ok 11 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 18800kb
input:
8374 17 923
output:
122084.508274122466 3.404569162681 6.809166387832 10.213819738151 13.618557276802 17.023407067642 20.428397175452 23.833555666171 27.238910607125 30.644490067261 34.050322117374
result:
ok 11 numbers
Test #34:
score: 0
Accepted
time: 3ms
memory: 18896kb
input:
4417 22 938
output:
83064.107687034018 0.083453754612 0.166911649958 0.250377826974 0.333856427011 0.417351592034 0.500867464830 0.584408189216 0.667977910237 0.751580774382 0.835220929782
result:
ok 11 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 15112kb
input:
7222 30 710
output:
185191.636297721483 1.302507830275 2.605060612172 3.907703298866 5.210480846634 6.513438216406 7.816620375320 9.120072298270 10.423838969462 11.727965383962 13.032496549254
result:
ok 11 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 16696kb
input:
3810 19 746
output:
61880.179773479507 0.276907005732 0.553827784572 0.830776110317 1.107765758129 1.384810505228 1.661924131576 1.939120420557 2.216413159671 2.493816141212 2.771343162959
result:
ok 11 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 13016kb
input:
5093 28 582
output:
121927.400380269640 0.851455817271 1.702963106886 2.554573344302 3.406338011197 4.258308598588 5.110536609937 5.963073564270 6.815970999289 7.669280474485 8.523053574263
result:
ok 11 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 14996kb
input:
6834 19 711
output:
111261.799946590527 3.281856944611 6.563764624525 9.845773775827 13.127935136173 16.410299445572 19.692917447169 22.975839888032 26.259117519934 29.542801100142 32.826941392195
result:
ok 11 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 16816kb
input:
9808 44 779
output:
368851.258658519987 0.882797324563 1.765630183132 2.648534111146 3.531544646902 4.414697332989 5.298027717718 6.181571356552 7.065363813539 7.949440662742 8.833837489670
result:
ok 11 numbers