Submission #65002666


Source Code Expand

#include<bits/stdc++.h>
#define int long long
#define FastIO
#ifdef FastIO
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin)),*p2=0,*p1++)
#endif //#ifdef FastIO
using namespace std;int n,m,k;
namespace IO{char buf[8888888],*p1=buf,*p2=buf,ibuf;
int rd(int x=0,int f=1){for(;!isdigit(ibuf);ibuf=getchar())ibuf=='-'&&(f=-1);for(;isdigit(ibuf);ibuf=getchar())x=(x<<1)+(x<<3)+(ibuf^48);return x*f;}
int rds(char*s,int n=0){for(;!isgraph(ibuf);ibuf=getchar());for(;isgraph(ibuf);ibuf=getchar())s[n++]=ibuf;return s[n]=0,n;}
}using IO::rd;using IO::rds;//namespace IO
#define fio(s) (freopen(s".in","r",stdin),freopen(s".out","w",stdout))

int s[5050],c[5050];
double p[5050];
double f[256][5050];

signed main(){int Tst=1;
//Tst=rd();
while(Tst--){

	n=rd();
	m=rd();
	for(int i=0;i<n;i++)s[i]=rd(),c[i]=rd(),p[i]=rd()*0.01;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<=m;j++)
		{
			for(int k=0;k<n;k++)if(i>>k&1)
			{
				if(j>=c[k])f[i][j]=max(f[i][j],f[i][j-c[k]]*(1-p[k])+p[k]*(f[i^(1<<k)][j-c[k]]+s[k]));
			}
		}
	}
	printf("%.14lf\n",f[(1<<n)-1][m]);

//newline!
}return 0;}

Submission Info

Submission Time
Task E - Payment Required
User while_1
Language C++ 20 (gcc 12.2)
Score 450
Code Size 1134 Byte
Status AC
Exec Time 22 ms
Memory 13940 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 450 / 450
Status
AC × 4
AC × 43
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt, 02_random_23.txt, 02_random_24.txt, 02_random_25.txt, 02_random_26.txt, 02_random_27.txt, 02_random_28.txt, 02_random_29.txt, 02_random_30.txt, 02_random_31.txt, 02_random_32.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3840 KiB
00_sample_01.txt AC 1 ms 3728 KiB
00_sample_02.txt AC 1 ms 4008 KiB
00_sample_03.txt AC 1 ms 4404 KiB
01_handmade_00.txt AC 1 ms 3824 KiB
01_handmade_01.txt AC 1 ms 3748 KiB
01_handmade_02.txt AC 1 ms 3892 KiB
01_handmade_03.txt AC 1 ms 3776 KiB
01_handmade_04.txt AC 21 ms 13864 KiB
01_handmade_05.txt AC 21 ms 13796 KiB
02_random_00.txt AC 1 ms 4116 KiB
02_random_01.txt AC 1 ms 3768 KiB
02_random_02.txt AC 1 ms 4384 KiB
02_random_03.txt AC 1 ms 3840 KiB
02_random_04.txt AC 1 ms 3936 KiB
02_random_05.txt AC 2 ms 4284 KiB
02_random_06.txt AC 1 ms 4088 KiB
02_random_07.txt AC 1 ms 3908 KiB
02_random_08.txt AC 2 ms 5012 KiB
02_random_09.txt AC 1 ms 3828 KiB
02_random_10.txt AC 11 ms 4932 KiB
02_random_11.txt AC 1 ms 3808 KiB
02_random_12.txt AC 18 ms 13740 KiB
02_random_13.txt AC 1 ms 3792 KiB
02_random_14.txt AC 16 ms 10876 KiB
02_random_15.txt AC 1 ms 3824 KiB
02_random_16.txt AC 14 ms 9600 KiB
02_random_17.txt AC 1 ms 3744 KiB
02_random_18.txt AC 11 ms 4888 KiB
02_random_19.txt AC 1 ms 4004 KiB
02_random_20.txt AC 18 ms 13816 KiB
02_random_21.txt AC 1 ms 3892 KiB
02_random_22.txt AC 15 ms 10716 KiB
02_random_23.txt AC 1 ms 3868 KiB
02_random_24.txt AC 17 ms 13044 KiB
02_random_25.txt AC 1 ms 3784 KiB
02_random_26.txt AC 20 ms 13872 KiB
02_random_27.txt AC 1 ms 3852 KiB
02_random_28.txt AC 22 ms 13748 KiB
02_random_29.txt AC 1 ms 4004 KiB
02_random_30.txt AC 18 ms 13800 KiB
02_random_31.txt AC 1 ms 4024 KiB
02_random_32.txt AC 18 ms 13940 KiB