QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#22933#2884. 切切糕ha114514ha#AC ✓31ms54852kbC++203.0kb2022-03-11 11:26:192022-04-30 02:08:44

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:08:44]
  • 评测
  • 测评结果:AC
  • 用时:31ms
  • 内存:54852kb
  • [2022-03-11 11:26:19]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#include<vector>
#include<map>
#include<bitset>
#include<set>
#include<cmath>
#include<ctime>
#include<random>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define bc(x) __builtin_popcount(x)
#define re register
#define il inline
#define pii pair<int,int>
#define pil pair<int,long long>
#define pll pair<long long,long long>
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))
#define dbg(x) cerr<<"In Line "<< __LINE__<<" the "<<#x<<" = "<<x<<'\n';
#define dpi(x,y) cerr<<"In Line "<<__LINE__<<" the "<<#x<<" = "<<x<<" ; "<<"the "<<#y<<" = "<<y<<'\n';
// #pragma GCC optimize(3)
//#define int long long
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
namespace IO_BUFF{
	mt19937 rnd(time(0)^(ll)(new char));
	int rend(int x){
		return rnd()%x+1;
	}
	void rendom_shuffle(int *a,int len){
		shuffle(a+1,a+len+1,rnd);
	}
	const int BS=(1<<24)+5;char Buffer[BS],*HD,*TL;
	inline int gc(){
	    if(HD==TL) TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);
	    return (HD==TL)?EOF:*HD++;
	}
	inline int inn(){
	    int x,ch,s=1;while((ch=gc())<'0'||ch>'9')if(ch=='-')s=-1;x=ch^'0';
	    while((ch=gc())>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^'0');return x*s;
	}
	char ssss[19999999],tttt[20];int ssl,ttl;
    inline int print(int x)
    {
        if(x<0)ssss[++ssl]='-',x=(-x);
		if(!x) ssss[++ssl]='0';for(ttl=0;x;x/=10) tttt[++ttl]=char(x%10+'0');
        for(;ttl;ttl--) ssss[++ssl]=tttt[ttl];return ssss[++ssl]='\n';
    }
	inline int Flush(){return fwrite(ssss+1,sizeof(char),ssl,stdout),ssl=0,0;}
	int read(){
		char c=getchar();int x=1;int s=0;
		while(c<'0' || c>'9'){if(c=='-')x=-1;c=getchar();}
		while(c>='0' && c<='9'){
			s=s*10+c-'0';c=getchar();
		}
		return s*x;
	}
}using namespace IO_BUFF;
/*namespace CFConTest{
	const int mod=998244353;
	inline int add(const int &x,const int &y){
		return (x+y>=mod?x+y-mod:x+y);
	}
	inline int del(const int &x,const int &y){
		return (x-y<0?x-y+mod:x-y);
	}
	int ksm(int x,int k){
		int base=1;
		while(k){
			if(k&1)base=1ll*base*x%mod;
			k>>=1;
			x=1ll*x*x%mod;
		}
		return base;
	}
};
using namespace CFConTest;*/
const int N=2505;
int n,m,a[N],s[N];
double f[N][N];
double dp(int x,int y){
	if(f[x][y]!=-1)return f[x][y]; 
	if(n-x+1==y){
		return 1.0*s[x]/2;
	}
	if(!y){
		return s[x];
	}
	double kx=dp(x+1,y-1);
	double ky=dp(x+1,y);
	double ans=0;
	if(ky+a[x]<=kx){
		ans=ky+a[x];
	}
	else {
		ans=kx+1.0*(a[x]-kx+ky)/2.0;
	}
	f[x][y]=ans;
	return f[x][y];
}
int main(){
	#ifdef newbiewzs
		freopen("checkout11.in","r",stdin); 
	#else
	#endif
	n=read();m=read();
	for(int i=1;i<=n;i++)a[i]=read();
 	for(int i=1;i<=n;i++)for(int k=0;k<=n;k++)f[i][k]=-1;
 	sort(a+1,a+n+1);
 	for(int i=n;i>=1;i--)s[i]=s[i+1]+a[i];
 	printf("%.10lf",dp(1,m));
    #ifdef newbiewzs
		cerr<<'\n'<<"Time:"<<clock()<<" ms"<<'\n';
	#endif
	return 0;
}


詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 5776kb

input:

1 1
10

output:

5.0000000000

result:

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

Test #2:

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

input:

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

output:

10.0351562500

result:

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

Test #3:

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

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

result:

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

Test #4:

score: 0
Accepted
time: 8ms
memory: 53424kb

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

result:

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

Test #5:

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

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

result:

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

Test #6:

score: 0
Accepted
time: 9ms
memory: 54852kb

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

result:

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

Test #7:

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

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

result:

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

Test #8:

score: 0
Accepted
time: 31ms
memory: 54104kb

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

result:

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

Test #9:

score: 0
Accepted
time: 25ms
memory: 52976kb

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

result:

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

Test #10:

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

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

result:

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

Test #11:

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

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

result:

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

Test #12:

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

input:

2 1
30 100

output:

80.0000000000

result:

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

Test #13:

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

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

result:

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

Test #14:

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

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

result:

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

Test #15:

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

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

result:

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

Test #16:

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

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

result:

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

Test #17:

score: 0
Accepted
time: 16ms
memory: 53916kb

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

result:

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

Test #18:

score: 0
Accepted
time: 28ms
memory: 54236kb

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

result:

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

Test #19:

score: 0
Accepted
time: 28ms
memory: 54312kb

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

result:

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

Test #20:

score: 0
Accepted
time: 8ms
memory: 53644kb

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

result:

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

Test #21:

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

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

result:

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

Test #22:

score: 0
Accepted
time: 7ms
memory: 35352kb

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

result:

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

Test #23:

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

input:

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

output:

442.7500000000

result:

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

Test #24:

score: 0
Accepted
time: 7ms
memory: 35576kb

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

result:

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

Test #25:

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

input:

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

output:

261.6250000000

result:

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

Test #26:

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

input:

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

output:

380.8984375000

result:

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

Test #27:

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

input:

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

output:

381.3593750000

result:

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

Test #28:

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

input:

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

output:

156.1484375000

result:

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

Test #29:

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

input:

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

output:

183.0000000000

result:

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

Test #30:

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

input:

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

output:

11.4169921875

result:

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