QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#810023#8091. Hypnocdx123456WA 1261ms33096kbC++14799b2024-12-11 19:12:082024-12-11 19:12:14

Judging History

你现在查看的是最新测评结果

  • [2024-12-11 19:12:14]
  • 评测
  • 测评结果:WA
  • 用时:1261ms
  • 内存:33096kb
  • [2024-12-11 19:12:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,f[200010];
vector<int> a[200010],v[200010];
__float128 d[200010];
void solve(int x){
	__float128 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<__float128,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",(double)d[1]);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 14180kb

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: 0ms
memory: 14236kb

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: 3ms
memory: 13960kb

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: 14124kb

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: 236ms
memory: 29836kb

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: 0
Accepted
time: 479ms
memory: 21060kb

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.113595742

result:

ok found '6673.113595742', expected '6673.113595742', error '0.000000000'

Test #7:

score: 0
Accepted
time: 11ms
memory: 15240kb

input:

3085 7273
3056 1272
1780 2634
1508 1580
85 1971
1468 913
2765 185
1345 1396
392 1019
2554 2458
1974 1575
2663 2388
569 1644
281 385
401 575
1580 2813
415 1585
1189 1170
1658 3081
9 1464
2819 1489
1422 1817
2726 1143
1205 452
991 722
1879 3027
933 683
1808 2156
221 2648
2488 2931
1255 1454
1317 2097
...

output:

709.396896362

result:

ok found '709.396896362', expected '709.396896362', error '0.000000000'

Test #8:

score: 0
Accepted
time: 11ms
memory: 15428kb

input:

3091 7287
2046 2436
2332 144
346 1687
2868 2316
177 268
1452 2832
2400 1168
560 2777
2821 2677
1468 561
2346 2283
2690 2998
2091 3044
2497 197
1855 1252
1474 1968
715 374
852 645
1196 1168
990 1783
1339 932
1300 645
94 798
129 762
2149 243
1476 1164
660 701
2277 67
2688 2298
2124 2194
1750 103
1931 ...

output:

710.865196228

result:

ok found '710.865196228', expected '710.865196228', error '0.000000000'

Test #9:

score: 0
Accepted
time: 11ms
memory: 15196kb

input:

3097 7301
1520 1628
1360 1654
2895 1499
746 787
2322 2579
3016 2415
3035 982
1404 2132
2544 604
751 787
3068 2303
2271 1850
1862 15
1567 2482
1269 117
2020 1374
1161 1096
1528 2519
1873 2029
530 2533
3043 650
634 2937
1271 970
2489 2472
1064 585
2036 2104
1746 3051
2919 708
809 1392
3094 31
2283 946...

output:

712.333496094

result:

ok found '712.333496094', expected '712.333496094', error '0.000000000'

Test #10:

score: 0
Accepted
time: 230ms
memory: 29500kb

input:

200000 200000
73936 52310
23970 11954
32769 131557
48708 70894
80135 123296
124840 111064
8190 101709
12650 54175
60397 191496
190035 89807
20653 185332
9497 197980
137875 101180
190627 179306
185624 162761
7501 129957
189805 120027
117897 38215
143992 107602
128103 105023
14390 124008
137117 87974
...

output:

149999.875000000

result:

ok found '149999.875000000', expected '149999.875000000', error '0.000000000'

Test #11:

score: 0
Accepted
time: 1261ms
memory: 33096kb

input:

100002 200000
11946 100002
76762 100002
32961 100002
7738 1
29437 1
100002 60929
1 29961
46824 100002
13968 100002
100002 46723
36958 100002
1 15848
14551 1
99692 1
1 49341
49596 100002
1 60721
786 100002
35475 1
32467 100002
58519 100002
1 90657
1 49613
15804 100002
71908 100002
24067 100002
26636 ...

output:

2.833333333

result:

ok found '2.833333333', expected '2.833333333', error '0.000000000'

Test #12:

score: 0
Accepted
time: 1065ms
memory: 19136kb

input:

14268 199556
4792 12361
5408 6400
7912 4711
7938 3150
309 8185
7976 10543
606 4123
184 13818
3105 596
12237 4157
2358 8984
3727 5146
12298 10746
7332 11693
4004 4164
8790 6465
2720 4080
10946 5209
11609 5029
14071 3549
9150 6303
12645 594
8744 541
7 12314
1075 6787
5930 11406
2729 4033
14265 12107
3...

output:

1360.166669197

result:

ok found '1360.166669197', expected '1360.166669197', error '0.000000000'

Test #13:

score: -100
Wrong Answer
time: 383ms
memory: 22328kb

input:

67552 199671
5017 53913
14091 27050
21945 33248
2610 64018
18246 52118
36710 19902
36113 64210
1642 48321
39038 3296
18964 5353
51231 16873
4434 83
32202 62529
44817 17487
14867 752
52110 7335
26341 46705
61659 3960
20533 53073
49107 60942
28716 12620
63699 62648
3302 62535
30932 49284
67417 52844
2...

output:

10117.323097597

result:

wrong answer 1st numbers differ - expected: '10115.3184016', found: '10117.3230976', error = '0.0001982'