QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#430965 | #5902. Upstairs/Downstairs | fanglong | 0 | 7672ms | 42904kb | C++14 | 963b | 2024-06-04 19:12:26 | 2024-06-04 19:12:27 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int read(){
int x=0;
char ch=getchar();
while(ch<'0'||ch>'9')ch=getchar();
while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
return x;
}
const int N=1000010;
int n,k,m;
double d[N];
bool cmp(double i,double j){
return i>j;
}
double pf[N],sf[N],pg[N],sg[N];
int main(){
int t=read();
while(t--){
n=read(),k=read();
m=0;
for(int i=1;i<=n;i++){
int a=read(),b=read(),c=read();
double k=1.0*a/b;
while(c--)d[++m]=k;
}
sort(d+1,d+m+1,cmp);
pf[0]=sf[0]=1;
for(int i=1;i<=m;i++){
pf[i]=pf[i-1]*d[i];
sf[i]=sf[i-1]-(sf[i-1]-pf[i-1])*d[i];
}
pg[m+1]=sg[m+1]=1;
for(int i=m;i>=1;i--){
pg[i]=pg[i+1]*(1-d[i]);
sg[i]=sg[i+1]-(sg[i+1]-pg[i+1])*(1-d[i]);
}
double ans=0;
for(int i=k,j=m+1;i>=0;i--,j--)ans=max(ans,sf[i]*pg[j]+pf[i]*sg[j]-pf[i]*pg[j]);
cout<<fixed<<setprecision(9)<<"Case #1: "<<1-ans<<'\n';
}
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 12052kb
input:
100 4 1 1/2 3 1/5 2 2/5 1 2/2 2 3 2 1/2 2 1/3 2 3/4 2 3 3 99/100 1 1/2 2 1/50 3 8 7 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 19 17 1/15 1 2/9 8 3/5 4 2/7 4 2/7 9 6/12 3 5/10 3 9/14 5 2/4 4 13/18 9 8/12 4 2/5 6 1/4 10 8/10 2 5/13 3 4/12 8 8/12 10 4/16 3 9/14 4 23 4 2/14 6 7/11 1 3/8 5 2/3 3 3/...
output:
Case #1: 0.000000000 Case #1: 0.083333333 Case #1: 0.015000000 Case #1: 0.937500000 Case #1: 0.972519685 Case #1: 0.280716368 Case #1: 0.653116312 Case #1: 0.625007979 Case #1: 0.714352006 Case #1: 0.899193148 Case #1: 0.340576172 Case #1: 0.746759461 Case #1: 0.000000000 Case #1: 0.000000000 Case #...
result:
wrong output format Expected '#2:' but found '#1:' (test case 2)
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 7672ms
memory: 42904kb
input:
100 4 1 1/2 3 1/5 2 2/5 1 2/2 2 3 2 1/2 2 1/3 2 3/4 2 3 3 99/100 1 1/2 2 1/50 3 8 7 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 1/2 1 19 17 1/15 1 2/9 8 3/5 4 2/7 4 2/7 9 6/12 3 5/10 3 9/14 5 2/4 4 13/18 9 8/12 4 2/5 6 1/4 10 8/10 2 5/13 3 4/12 8 8/12 10 4/16 3 9/14 4 23 4 2/14 6 7/11 1 3/8 5 2/3 3 3/...
output:
Case #1: 0.000000000 Case #1: 0.083333333 Case #1: 0.015000000 Case #1: 0.937500000 Case #1: 0.972519685 Case #1: 0.280716368 Case #1: 0.653116312 Case #1: 0.625007979 Case #1: 0.714352006 Case #1: 0.899193148 Case #1: 0.981122241 Case #1: 0.584037952 Case #1: 0.765986193 Case #1: 0.496987392 Case #...
result:
wrong output format Expected '#2:' but found '#1:' (test case 2)