답안 #375788

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
375788 2021-03-10T02:03:07 Z casperwang Two Dishes (JOI19_dishes) C++14
10 / 100
51 ms 63136 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define debug(args...) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }

const int MAXN = 2000;
int n, m;
int a[MAXN+1], b[MAXN+1];
int s[MAXN+1], t[MAXN+1];
int p[MAXN+1], q[MAXN+1];
int ti[MAXN+1][MAXN+1];
int dp[MAXN+1][MAXN+1];

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> s[i] >> p[i];
		ti[i][0] = ti[i-1][0] + a[i];
	}
	for (int i = 1; i <= m; i++) {
		cin >> b[i] >> t[i] >> q[i];
	}
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (j) ti[i][j] = ti[i][j-1] + b[j];
			dp[i][j] = max((i?dp[i-1][j]:0) + (ti[i][j] <= s[i]) * p[i],
										 (j?dp[i][j-1]:0) + (ti[i][j] <= t[j]) * q[j]);
		}
	}
	cout << dp[n][m] << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 17388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 492 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 492 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
17 Correct 47 ms 63084 KB Output is correct
18 Correct 48 ms 63084 KB Output is correct
19 Correct 48 ms 63084 KB Output is correct
20 Correct 51 ms 63136 KB Output is correct
21 Correct 47 ms 60780 KB Output is correct
22 Correct 49 ms 63084 KB Output is correct
23 Correct 47 ms 63084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 492 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
17 Correct 47 ms 63084 KB Output is correct
18 Correct 48 ms 63084 KB Output is correct
19 Correct 48 ms 63084 KB Output is correct
20 Correct 51 ms 63136 KB Output is correct
21 Correct 47 ms 60780 KB Output is correct
22 Correct 49 ms 63084 KB Output is correct
23 Correct 47 ms 63084 KB Output is correct
24 Runtime error 45 ms 17260 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 492 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
17 Correct 47 ms 63084 KB Output is correct
18 Correct 48 ms 63084 KB Output is correct
19 Correct 48 ms 63084 KB Output is correct
20 Correct 51 ms 63136 KB Output is correct
21 Correct 47 ms 60780 KB Output is correct
22 Correct 49 ms 63084 KB Output is correct
23 Correct 47 ms 63084 KB Output is correct
24 Runtime error 45 ms 17260 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 492 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 492 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 1 ms 492 KB Output is correct
17 Correct 47 ms 63084 KB Output is correct
18 Correct 48 ms 63084 KB Output is correct
19 Correct 48 ms 63084 KB Output is correct
20 Correct 51 ms 63136 KB Output is correct
21 Correct 47 ms 60780 KB Output is correct
22 Correct 49 ms 63084 KB Output is correct
23 Correct 47 ms 63084 KB Output is correct
24 Runtime error 45 ms 17260 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 17388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 17388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -