Submission #796190

# Submission time Handle Problem Language Result Execution time Memory
796190 2023-07-28T07:40:29 Z Dan4Life Two Dishes (JOI19_dishes) C++17
10 / 100
1486 ms 75340 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mxN = (int)2e3+10;
const int LINF = (int)2e18;
int n, m;
int dp[mxN][mxN];
int a[2][mxN], s[2][mxN], p[2][mxN], pr[2][mxN];

int32_t main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	for(int j : {0,1}){
		for(int i = 1; i <= n; i++){
			cin >> a[j][i] >> s[j][i] >> p[j][i];
			pr[j][i]=pr[j][i-1]+a[j][i];
		}
		swap(n,m);
	}
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			int tim = pr[0][i]+pr[1][j];
			if(i) dp[i][j] = max(0ll,dp[i-1][j]+(tim<=s[0][i])*p[0][i]);
			if(j) dp[i][j] = max(dp[i][j],dp[i][j-1]+(tim<=s[1][j])*p[1][j]);
		}
	}
	cout << dp[n][m] << "\n";
}
# Verdict Execution time Memory Grader output
1 Runtime error 1486 ms 64840 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 26 ms 31920 KB Output is correct
18 Correct 27 ms 32000 KB Output is correct
19 Correct 28 ms 31968 KB Output is correct
20 Correct 25 ms 31912 KB Output is correct
21 Correct 25 ms 30724 KB Output is correct
22 Correct 25 ms 31936 KB Output is correct
23 Correct 29 ms 32020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 26 ms 31920 KB Output is correct
18 Correct 27 ms 32000 KB Output is correct
19 Correct 28 ms 31968 KB Output is correct
20 Correct 25 ms 31912 KB Output is correct
21 Correct 25 ms 30724 KB Output is correct
22 Correct 25 ms 31936 KB Output is correct
23 Correct 29 ms 32020 KB Output is correct
24 Runtime error 1472 ms 75340 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 26 ms 31920 KB Output is correct
18 Correct 27 ms 32000 KB Output is correct
19 Correct 28 ms 31968 KB Output is correct
20 Correct 25 ms 31912 KB Output is correct
21 Correct 25 ms 30724 KB Output is correct
22 Correct 25 ms 31936 KB Output is correct
23 Correct 29 ms 32020 KB Output is correct
24 Runtime error 1472 ms 75340 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 26 ms 31920 KB Output is correct
18 Correct 27 ms 32000 KB Output is correct
19 Correct 28 ms 31968 KB Output is correct
20 Correct 25 ms 31912 KB Output is correct
21 Correct 25 ms 30724 KB Output is correct
22 Correct 25 ms 31936 KB Output is correct
23 Correct 29 ms 32020 KB Output is correct
24 Runtime error 1472 ms 75340 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1486 ms 64840 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1486 ms 64840 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -