QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#22939#2884. 切切糕LFCode#AC ✓18ms52636kbC++14697b2022-03-11 11:31:472022-04-30 02:09:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 02:09:11]
  • 评测
  • 测评结果:AC
  • 用时:18ms
  • 内存:52636kb
  • [2022-03-11 11:31:47]
  • 提交

answer

//什么时候我才能有杜爷一半强啊/kk
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int N=2555;
int n,m,a[N];
double f[N][N];
int read(){
	char ch=getchar();int nn=0,ssss=1;
	while(ch<'0'||ch>'9'){if(ch=='-')ssss*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){nn=nn*10+(ch-'0');ch=getchar();}
	return nn*ssss;
}
int main(){
	n=read();m=read();
	for(int i=1;i<=n;i++)a[i]=read();
	sort(a+1,a+n+1,[&](int a,int b){return a>b;});int sum=0;
	for(int i=1;i<=n;i++){
		sum+=a[i];
		for(int j=1;j<=m&&j<i;j++)
			f[i][j]=max(f[i-1][j],0.5*(a[i]+f[i-1][j-1]+f[i-1][j]));
		if(i<=m)f[i][i]=0.5*sum;
	}
	printf("%.6lf",1.0*sum-f[n][m]);
}

详细

Test #1:

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

input:

1 1
10

output:

5.000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 3ms
memory: 3836kb

input:

10 8
1 2 3 1 2 2 1 3 3 2

output:

10.035156

result:

ok found '10.0351560', expected '10.0351562', error '0.0000000'

Test #3:

score: 0
Accepted
time: 3ms
memory: 38288kb

input:

2500 1
1 1 2 1 4 1 5 1 2 2 3 4 2 3 4 3 4 1 4 5 3 5 4 4 1 3 3 3 5 5 5 3 2 2 3 2 3 2 1 1 5 4 2 1 3 4 3 4 2 3 1 1 2 2 2 4 3 1 1 4 2 2 4 3 5 4 2 3 1 1 4 3 3 4 3 1 2 1 1 2 2 4 4 3 3 2 5 4 2 4 5 4 5 3 1 5 1 3 3 1 1 3 5 3 5 1 1 4 3 5 2 4 1 5 2 1 3 3 1 1 5 2 1 3 4 1 2 4 2 2 2 3 5 1 1 3 1 1 5 1 2 3 3 5 4 4 5...

output:

7442.000000

result:

ok found '7442.0000000', expected '7442.0000000', error '0.0000000'

Test #4:

score: 0
Accepted
time: 3ms
memory: 38296kb

input:

2500 4
2 2 5 4 1 2 2 4 4 2 3 4 4 1 3 3 1 4 1 5 5 2 1 3 1 1 5 5 2 2 5 2 5 2 5 3 5 5 5 2 3 4 3 3 5 5 3 3 3 3 1 1 4 1 4 2 2 5 4 1 2 3 5 2 1 5 3 2 3 1 4 4 2 3 5 1 3 3 5 5 3 2 4 2 4 2 5 5 4 1 4 3 1 1 2 5 5 3 2 2 1 5 2 4 4 3 1 5 2 3 2 5 4 2 2 2 1 4 1 4 4 3 3 5 4 2 4 2 3 2 5 1 2 4 3 1 1 3 5 5 3 5 2 3 5 5 5...

output:

7512.000000

result:

ok found '7512.0000000', expected '7512.0000000', error '0.0000000'

Test #5:

score: 0
Accepted
time: 2ms
memory: 38408kb

input:

2500 16
2 4 5 3 3 5 5 2 1 5 2 5 1 3 5 4 2 1 2 4 1 1 5 4 1 1 4 1 4 3 4 2 3 3 1 3 4 4 3 5 5 4 3 1 4 1 1 4 2 5 5 5 4 5 3 3 2 3 2 4 1 5 5 4 5 5 4 2 2 3 4 2 1 3 1 3 1 1 3 4 4 3 1 2 1 1 4 5 4 1 1 1 3 4 4 2 2 1 2 2 4 1 5 5 5 1 1 3 2 3 5 2 1 4 5 4 1 3 4 3 5 1 3 4 1 1 4 1 5 3 2 1 2 5 1 1 3 2 4 1 4 2 2 1 1 5 ...

output:

7490.000000

result:

ok found '7490.0000000', expected '7490.0000000', error '0.0000000'

Test #6:

score: 0
Accepted
time: 2ms
memory: 38752kb

input:

2500 64
1 5 3 5 3 2 4 4 5 4 1 2 3 3 1 2 5 3 1 3 1 2 1 4 1 1 1 5 5 5 4 5 5 4 1 1 5 1 2 4 1 1 1 1 5 5 4 2 4 3 2 5 1 1 2 5 2 1 2 2 4 3 1 2 2 1 5 2 5 1 2 3 5 4 4 5 1 4 5 3 5 2 4 2 5 4 1 1 3 4 4 5 5 2 5 4 1 2 2 2 2 3 5 4 5 5 4 1 1 4 1 2 4 4 4 1 1 3 1 2 5 2 5 4 4 3 3 2 3 4 5 4 2 2 1 1 3 4 5 4 5 1 1 5 2 2 ...

output:

7130.000000

result:

ok found '7130.0000000', expected '7130.0000000', error '0.0000000'

Test #7:

score: 0
Accepted
time: 2ms
memory: 40180kb

input:

2500 256
1 2 1 4 5 5 3 2 2 4 5 3 5 5 3 5 1 5 2 4 2 4 3 5 1 1 5 1 3 1 5 3 5 5 2 2 4 5 2 1 2 5 2 4 4 5 1 2 5 5 1 4 1 4 1 5 2 2 2 5 5 1 1 5 5 4 1 2 2 3 4 3 4 4 5 2 4 2 1 2 2 3 5 3 2 3 5 1 3 5 1 4 4 5 3 1 3 5 2 2 2 3 5 4 5 2 2 3 4 4 4 4 3 4 1 4 1 2 3 3 1 3 5 4 1 4 2 1 5 2 5 3 4 2 4 2 4 3 5 5 3 5 1 4 2 2...

output:

6332.888860

result:

ok found '6332.8888600', expected '6332.8888601', error '0.0000000'

Test #8:

score: 0
Accepted
time: 2ms
memory: 45800kb

input:

2500 1024
1 3 5 5 5 3 4 3 4 5 4 5 4 2 3 2 2 4 4 5 4 1 2 5 4 4 2 5 2 5 5 5 2 4 2 3 2 4 5 3 4 2 3 1 1 4 2 2 5 1 3 5 5 2 3 1 4 3 4 5 2 3 4 3 2 3 2 2 5 4 3 5 2 1 4 1 1 5 4 2 3 2 1 2 2 3 1 4 5 1 4 1 5 4 4 5 5 3 3 1 3 4 5 4 5 4 2 5 3 1 3 2 3 1 2 5 1 2 2 4 1 1 2 4 1 2 5 4 4 1 3 2 4 2 4 1 1 2 2 3 2 2 1 2 4 ...

output:

3975.447637

result:

ok found '3975.4476370', expected '3975.4476368', error '0.0000000'

Test #9:

score: 0
Accepted
time: 4ms
memory: 52428kb

input:

2500 2048
4 5 2 4 1 3 5 3 5 5 5 5 2 1 3 5 3 2 1 5 5 5 1 5 2 2 2 2 3 3 2 5 2 1 5 4 4 4 4 4 1 4 3 3 2 3 4 2 1 5 5 4 5 4 5 3 4 2 4 1 2 2 5 5 3 5 2 1 5 3 1 2 3 2 3 1 5 3 2 4 5 4 4 2 1 1 1 2 2 4 2 1 5 5 4 5 3 1 5 4 5 5 3 5 5 1 2 4 4 3 3 2 1 1 1 3 3 5 3 2 3 4 1 3 2 3 5 4 4 4 1 1 1 2 4 2 1 1 2 4 5 5 1 5 2 ...

output:

3725.500000

result:

ok found '3725.5000000', expected '3725.5000000', error '0.0000000'

Test #10:

score: 0
Accepted
time: 15ms
memory: 52636kb

input:

2500 2498
5 5 1 1 3 1 4 4 3 1 4 2 4 3 2 2 2 1 3 1 2 5 5 5 3 5 5 5 4 2 4 2 1 1 5 2 1 3 4 1 5 2 3 4 4 4 5 2 5 4 2 3 4 2 4 3 5 3 2 1 2 1 3 2 5 4 3 5 3 4 5 4 1 4 2 3 3 5 3 5 2 3 5 4 1 3 2 5 4 2 2 3 3 1 4 4 3 4 1 4 5 1 4 4 5 3 2 2 5 1 2 5 1 2 5 1 1 5 2 3 5 3 1 3 2 2 3 2 3 3 2 5 2 2 2 5 3 4 5 2 5 3 1 3 4 ...

output:

3736.000000

result:

ok found '3736.0000000', expected '3736.0000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 4ms
memory: 51584kb

input:

2500 2499
2 2 3 3 5 5 5 5 4 4 5 3 2 1 2 3 3 5 3 2 5 5 4 5 5 1 2 2 5 4 3 3 2 3 3 1 1 3 1 5 5 4 3 1 3 3 2 2 1 3 2 3 4 4 5 1 5 2 5 1 2 1 1 1 3 1 1 5 3 2 1 1 2 5 1 2 2 5 3 5 4 5 3 5 1 3 4 3 1 5 5 2 1 3 4 3 4 4 1 4 2 5 2 2 2 3 2 1 1 3 2 1 4 2 5 4 2 3 5 5 2 1 2 2 3 1 3 1 4 3 5 2 4 1 2 1 3 5 4 1 3 1 1 2 1 ...

output:

3686.500000

result:

ok found '3686.5000000', expected '3686.5000000', error '0.0000000'

Test #12:

score: 0
Accepted
time: 3ms
memory: 3736kb

input:

2 1
30 100

output:

80.000000

result:

ok found '80.0000000', expected '80.0000000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 12ms
memory: 51860kb

input:

2500 2500
5 2 1 2 2 4 2 5 5 4 1 3 5 5 3 1 1 2 5 4 1 4 5 2 5 5 1 4 1 2 5 3 5 5 4 2 5 3 1 1 1 1 3 3 3 2 5 3 2 3 4 2 1 2 3 1 5 1 4 5 1 2 1 3 5 1 5 4 5 4 2 3 5 1 3 2 1 4 3 3 1 2 1 5 5 1 5 3 1 3 3 2 2 4 2 2 2 3 3 5 3 1 5 5 2 2 4 2 2 5 1 1 2 4 5 2 1 1 1 3 4 3 2 1 3 2 3 1 1 1 1 5 1 4 2 3 3 1 4 2 3 4 5 1 1 ...

output:

3701.500000

result:

ok found '3701.5000000', expected '3701.5000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 4ms
memory: 38284kb

input:

2500 1
8196 21177 1003 26963 3920 5933 23757 21559 13642 7054 28157 16882 4988 26896 12909 15867 21135 25735 7987 15972 20578 29738 16955 6074 21593 12951 14649 26669 24056 21272 5346 15856 16816 6949 31836 31971 2040 5418 9459 18288 17056 24714 29197 28338 19554 17123 20832 11741 9915 24212 10082 1...

output:

41219654.803955

result:

ok found '41219654.8039550', expected '41219654.8039551', error '0.0000000'

Test #15:

score: 0
Accepted
time: 3ms
memory: 38404kb

input:

2500 5
8226 19609 30709 14157 31215 8505 19001 27981 31174 17257 26825 17278 7630 11973 16030 8070 353 27722 24464 31086 25013 5227 21016 3669 21948 14176 9818 11110 15688 8130 32355 9479 11123 9045 27567 20051 20542 30245 17902 1227 9592 13268 24327 9288 25314 4914 14430 30517 32144 30734 7507 3045...

output:

41572840.294108

result:

ok found '41572840.2941080', expected '41572840.2941078', error '0.0000000'

Test #16:

score: 0
Accepted
time: 2ms
memory: 38476kb

input:

2500 25
8262 6769 30607 16709 13603 18931 20470 28549 16194 15164 25198 17763 21781 30142 30768 2181 439 1023 11834 27713 19512 11677 22339 15294 18741 4751 14836 28502 27307 2989 32597 12607 524 29811 25990 5483 10387 16898 2735 2220 469 2919 25657 15132 3226 26400 13887 2492 30186 16860 7999 11099...

output:

40426689.650408

result:

ok found '40426689.6504080', expected '40426689.6504075', error '0.0000000'

Test #17:

score: 0
Accepted
time: 1ms
memory: 39156kb

input:

2500 125
8288 27220 9680 12608 30584 17577 12602 5131 17214 31516 24015 18115 2284 31441 11698 9814 18375 17353 26480 19303 12532 4452 11386 5875 4492 27685 21465 29236 8947 2230 23837 17861 13669 6188 3990 27656 26833 28043 6599 8901 26603 7309 17688 16403 22909 30111 4555 11900 31741 813 20273 297...

output:

36999148.439013

result:

ok found '36999148.4390130', expected '36999148.4390133', error '0.0000000'

Test #18:

score: 0
Accepted
time: 3ms
memory: 42628kb

input:

2500 625
8314 14904 21521 8506 14796 16223 4733 14481 18235 15099 22832 18467 15555 32740 25395 17446 3543 915 8357 10892 5552 29996 433 29223 23012 17852 28093 29969 23354 1470 15076 23115 26813 15333 14759 17060 10511 6421 10463 15581 19968 11698 9718 17674 9823 1054 27991 21307 529 17533 32547 15...

output:

25909899.971323

result:

ok found '25909899.9713230', expected '25909899.9713232', error '0.0000000'

Test #19:

score: 0
Accepted
time: 3ms
memory: 44924kb

input:

2500 996
996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996...

output:

1497984.000000

result:

ok found '1497984.0000000', expected '1497984.0000000', error '0.0000000'

Test #20:

score: 0
Accepted
time: 0ms
memory: 38272kb

input:

2500 1
404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 4...

output:

1009596.000000

result:

ok found '1009596.0000000', expected '1009596.0000000', error '0.0000000'

Test #21:

score: 0
Accepted
time: 18ms
memory: 52268kb

input:

2500 2500
404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 40...

output:

505000.000000

result:

ok found '505000.0000000', expected '505000.0000000', error '0.0000000'

Test #22:

score: 0
Accepted
time: 5ms
memory: 32732kb

input:

1516 215
28462 4775 4206 8502 18550 7709 29283 3985 23800 27937 24054 18488 12582 9584 2244 30178 8746 22424 2285 16062 17357 30034 16924 3425 21911 529 9153 26115 4919 12763 7329 7148 25638 27224 26513 31529 11912 23081 5502 14979 20819 6778 30897 18866 2482 3803 21841 20429 18348 30539 31530 28165...

output:

18721172.943004

result:

ok found '18721172.9430040', expected '18721172.9430038', error '0.0000000'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

10 1
36 9 3 96 55 34 80 93 52 60

output:

442.750000

result:

ok found '442.7500000', expected '442.7500000', error '0.0000000'

Test #24:

score: 0
Accepted
time: 6ms
memory: 34856kb

input:

1522 994
31423 20133 24835 16355 24775 1854 29538 24456 23504 28026 2795 18812 24198 11492 23112 1493 12407 3937 25116 14255 14618 11295 13361 25543 31760 713 29139 1350 10921 22269 2423 25818 28330 24575 30625 26123 21070 8367 3844 16077 27018 31672 3050 19793 8341 22539 30422 33 21416 27020 6760 1...

output:

12531247.500000

result:

ok found '12531247.5000000', expected '12531247.5000000', error '0.0000000'

Test #25:

score: 0
Accepted
time: 3ms
memory: 3764kb

input:

10 2
1 1 6 42 39 33 93 84 4 71

output:

261.625000

result:

ok found '261.6250000', expected '261.6250000', error '0.0000000'

Test #26:

score: 0
Accepted
time: 3ms
memory: 5800kb

input:

10 3
56 84 17 3 79 51 69 56 89 58

output:

380.898438

result:

ok found '380.8984380', expected '380.8984375', error '0.0000000'

Test #27:

score: 0
Accepted
time: 3ms
memory: 3844kb

input:

10 5
9 50 100 100 72 43 100 88 31 93

output:

381.359375

result:

ok found '381.3593750', expected '381.3593750', error '0.0000000'

Test #28:

score: 0
Accepted
time: 3ms
memory: 3860kb

input:

10 8
58 4 51 1 18 8 51 15 29 76

output:

156.148438

result:

ok found '156.1484380', expected '156.1484375', error '0.0000000'

Test #29:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

10 10
3 42 73 8 82 46 57 1 15 39

output:

183.000000

result:

ok found '183.0000000', expected '183.0000000', error '0.0000000'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

10 5
1 3 3 2 1 1 1 3 2 3

output:

11.416992

result:

ok found '11.4169920', expected '11.4169922', error '0.0000000'