Submission #65033916


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

//#define filename "xxx" 
#define FileOperations() freopen(filename".in", "r", stdin), freopen(filename".out", "w", stdout)
//#define multi_cases 1

#define inf 0x3f3f3f3f
#define Linf 0x3f3f3f3f3f3f3f3f
#define pii pair<int, int> 
#define all(v) v.begin(), v.end()
#define upw(i, a, b) for(int i = (a); i <= (b); ++i)
#define dnw(i, a, b) for(int i = (a); i >= (b); --i)

template<class T> bool vmax(T &a, T b) { return b > a ? a = b, true : false; }
template<class T> bool vmin(T &a, T b) { return b < a ? a = b, true : false; }
template<class T> void clear(T &x) { T().swap(x); }

const int N = 10;

int n, x, s[N], c[N];
double p[N];

double f[5002][1000];
double calc(int x, int S) {
	if(f[x][S] > 1e-6) return f[x][S];
	upw(i, 1, n) if(c[i] <= x && !(S >> i & 1)) 
		vmax(f[x][S], p[i] * (s[i] + calc(x - c[i], S | 1 << i)) + (1 - p[i]) * calc(x - c[i], S));
	return f[x][S];
}

void Traveller() {
	cin >> n >> x;
	upw(i, 1, n) cin >> s[i] >> c[i] >> p[i], p[i] /= 100;
	printf("%.6f\n", calc(x, 0));
}

signed main() {
#ifdef filename
	FileOperations();
#endif
	
	signed _ = 1;
#ifdef multi_cases
	scanf("%d", &_);
#endif
	while(_--) Traveller();
	return 0;
}

Submission Info

Submission Time
Task E - Payment Required
User Wangfengchi
Language C++ 23 (Clang 16.0.6)
Score 450
Code Size 1265 Byte
Status AC
Exec Time 72 ms
Memory 43360 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 3716 KiB
00_sample_01.txt AC 1 ms 3832 KiB
00_sample_02.txt AC 1 ms 3948 KiB
00_sample_03.txt AC 1 ms 4168 KiB
01_handmade_00.txt AC 1 ms 3820 KiB
01_handmade_01.txt AC 1 ms 3820 KiB
01_handmade_02.txt AC 11 ms 24180 KiB
01_handmade_03.txt AC 11 ms 24244 KiB
01_handmade_04.txt AC 67 ms 43336 KiB
01_handmade_05.txt AC 65 ms 43360 KiB
02_random_00.txt AC 1 ms 3784 KiB
02_random_01.txt AC 1 ms 3724 KiB
02_random_02.txt AC 1 ms 3968 KiB
02_random_03.txt AC 1 ms 3732 KiB
02_random_04.txt AC 1 ms 3732 KiB
02_random_05.txt AC 14 ms 25168 KiB
02_random_06.txt AC 12 ms 24420 KiB
02_random_07.txt AC 8 ms 18012 KiB
02_random_08.txt AC 14 ms 23204 KiB
02_random_09.txt AC 1 ms 3744 KiB
02_random_10.txt AC 1 ms 3820 KiB
02_random_11.txt AC 2 ms 5860 KiB
02_random_12.txt AC 7 ms 7852 KiB
02_random_13.txt AC 1 ms 3852 KiB
02_random_14.txt AC 1 ms 3732 KiB
02_random_15.txt AC 1 ms 3832 KiB
02_random_16.txt AC 1 ms 3784 KiB
02_random_17.txt AC 1 ms 3724 KiB
02_random_18.txt AC 1 ms 3748 KiB
02_random_19.txt AC 6 ms 13984 KiB
02_random_20.txt AC 33 ms 23900 KiB
02_random_21.txt AC 1 ms 3724 KiB
02_random_22.txt AC 1 ms 3768 KiB
02_random_23.txt AC 1 ms 3880 KiB
02_random_24.txt AC 1 ms 4044 KiB
02_random_25.txt AC 12 ms 23960 KiB
02_random_26.txt AC 71 ms 43316 KiB
02_random_27.txt AC 12 ms 24192 KiB
02_random_28.txt AC 68 ms 43248 KiB
02_random_29.txt AC 6 ms 14004 KiB
02_random_30.txt AC 69 ms 43248 KiB
02_random_31.txt AC 12 ms 23944 KiB
02_random_32.txt AC 72 ms 43156 KiB