QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#810021 | #8091. Hypno | cdx123456 | WA | 477ms | 29692kb | C++14 | 813b | 2024-12-11 19:10:53 | 2024-12-11 19:11:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define double __float128
int n,m,f[200010];
vector<int> a[200010],v[200010];
double d[200010];
void solve(int x){
double z=0,k=1e9,p=1;
for(int i=0;i<a[x].size();i++){
int y=a[x][i];
z+=0.75*p*(d[y]+i+1);
p*=0.25;
k=min(k,z+(d[a[x][0]]+i+3)*p);
if(i>30) break;
}
d[x]=k;
}
int main(){
priority_queue<pair<double,int> > q;
int x,y;
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>x>>y;
v[x].push_back(y);
v[y].push_back(x);
}
d[n]=0;
q.push(make_pair(0,n));
while(!q.empty()){
int x=q.top().second; q.pop();
if(f[x]) continue;
f[x]=1;
for(int i=0;i<v[x].size();i++){
int y=v[x][i];
a[y].push_back(x);
solve(y);
q.push(make_pair(-d[y],y));
}
}
printf("%.9lf",(float)d[1]);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 14360kb
input:
3 3 1 2 1 3 2 3
output:
1.500000000
result:
ok found '1.500000000', expected '1.500000000', error '0.000000000'
Test #2:
score: 0
Accepted
time: 2ms
memory: 14200kb
input:
4 4 1 2 2 4 4 3 3 1
output:
2.875000000
result:
ok found '2.875000000', expected '2.875000000', error '0.000000000'
Test #3:
score: 0
Accepted
time: 2ms
memory: 13956kb
input:
2 1 2 1
output:
1.500000000
result:
ok found '1.500000000', expected '1.500000000', error '0.000000000'
Test #4:
score: 0
Accepted
time: 2ms
memory: 15376kb
input:
25 40 8 1 16 20 2 22 1 13 9 25 16 21 12 7 11 7 2 8 4 12 6 20 19 13 14 4 20 11 23 9 3 15 5 18 24 18 7 16 14 15 17 10 10 21 11 21 19 24 22 11 14 25 2 17 6 4 20 12 16 22 4 3 17 1 22 10 2 21 3 25 15 6 6 7 12 15 23 5 8 10
output:
11.990234375
result:
ok found '11.990234375', expected '11.990234375', error '0.000000000'
Test #5:
score: 0
Accepted
time: 232ms
memory: 29692kb
input:
200000 199999 197158 182193 108214 100271 143031 191662 102543 170330 22342 111905 51555 105985 38965 15493 85493 173312 117661 83898 19679 178046 145782 35268 89844 109186 74642 67192 135019 102320 48177 197815 128206 45459 11405 105702 6883 87640 51956 20707 93181 86619 40763 12411 129321 62642 14...
output:
299998.500000000
result:
ok found '299998.500000000', expected '299998.500000000', error '0.000000000'
Test #6:
score: -100
Wrong Answer
time: 477ms
memory: 20192kb
input:
50002 199753 36147 32879 17677 29414 27179 26413 46974 8267 7863 8233 6519 33179 38082 24048 6503 24095 42138 17324 11884 41691 34548 35590 23362 49160 6130 45565 9582 2905 16457 46999 38046 24288 30879 36499 267 5375 10150 17979 19495 49811 34233 21546 1172 23094 37255 6454 45445 33820 36559 9517 2...
output:
6673.113769531
result:
wrong answer 1st numbers differ - expected: '6673.1135957', found: '6673.1137695', error = '0.0000000'