Submission #796179

# Submission time Handle Problem Language Result Execution time Memory
796179 2023-07-28T07:29:16 Z Dan4Life Two Dishes (JOI19_dishes) C++17
0 / 100
392 ms 78348 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
const int mxN = (int)2e3+10;
const int LINF = (int)1e18;
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];
		for(int i = 1; i <= n; 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++)
			dp[i][j] = (i&j)*-LINF;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			int tim = pr[0][i]+pr[1][j];
			dp[i][j] = dp[i-1][j]+(tim<=s[0][i])*p[0][i];
			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 392 ms 78348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 392 ms 78348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 392 ms 78348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -