QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#22944 | #2884. 切切糕 | hy_zheng_zai_nei_juan# | AC ✓ | 66ms | 48412kb | C++20 | 1.7kb | 2022-03-11 11:37:35 | 2022-04-30 02:09:40 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<sstream>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<map>
#include<stack>
#include<set>
#include<functional>
#define in(x) x=read()
#define qr read()
#define int ll
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace fastIO
{
#define BUF_SIZE 100000
bool IOerror=0;
inline char nc()
{
static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
if (pend==p1){IOerror=1;return -1;}
}
return *p1++;
}
inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
inline ll read()
{
bool sign=0; char ch=nc();ll x=0;
for (;blank(ch);ch=nc());
if (IOerror)return 0;
if (ch=='-')sign=1,ch=nc();
for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
if (sign)x=-x;
return x;
}
#undef BUF_SIZE
};
using namespace fastIO;
int a[1000010];
double f[3010][3010];
int n,m;
double dfs(int x,int y)
{
// cout<<x<<' '<<y<<'\n';
if(f[x][y]>0)return f[x][y];
if(x>n)return 0;
if(!y)return f[x][y]=dfs(x+1,y)+a[x];
double w1=dfs(x+1,y-1),w2=dfs(x+1,y);
//w1+x w2+a[x]-x
if(w1>=w2+a[x])return f[x][y]=w2+a[x];
else return f[x][y]=(w1+w2+a[x])/2;
}
signed main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
n=qr,m=qr;
for(int i=1;i<=n;i++)in(a[i]);
sort(a+1,a+1+n);
printf("%.6f",dfs(1,m));
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 5768kb
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: 5776kb
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: 5ms
memory: 40088kb
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: 2ms
memory: 40184kb
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: 1ms
memory: 40208kb
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: 8ms
memory: 40816kb
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: 13ms
memory: 42456kb
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: 48ms
memory: 46632kb
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: 63ms
memory: 46828kb
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: 66ms
memory: 46508kb
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: 62ms
memory: 48412kb
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: 5860kb
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: 51ms
memory: 47312kb
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: 39936kb
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: 4ms
memory: 40308kb
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: 7ms
memory: 40136kb
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: 9ms
memory: 41188kb
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: 35ms
memory: 45232kb
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: 52ms
memory: 46868kb
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: 4ms
memory: 39972kb
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: 53ms
memory: 46260kb
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: 4ms
memory: 36508kb
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: 5896kb
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: 23ms
memory: 37396kb
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: 4ms
memory: 7820kb
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: 0ms
memory: 7696kb
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: 1ms
memory: 5820kb
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: 2ms
memory: 5804kb
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: 4ms
memory: 5812kb
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: 2ms
memory: 5852kb
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'