답안 #266288

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
266288 2020-08-15T07:43:38 Z dolphingarlic Two Dishes (JOI19_dishes) C++14
10 / 100
39 ms 31992 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

ll a[2001], b[2001], s[2001], t[2001], p[2001], q[2001];
ll dp[2001][2001];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> s[i] >> p[i];
        a[i] += a[i - 1];
    }
    for (int i = 1; i <= m; i++) {
        cin >> b[i] >> t[i] >> q[i];
        b[i] += b[i - 1];
    }
    for (int i = 1; i <= n; i++) dp[i][0] = dp[i - 1][0] + p[i] * (a[i] <= s[i]);
    for (int i = 1; i <= m; i++) dp[0][i] = dp[0][i - 1] + q[i] * (b[i] <= t[i]);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            dp[i][j] = max(dp[i - 1][j] + p[i] * (a[i] + b[j] <= s[i]), dp[i][j - 1] + q[j] * (a[i] + b[j] <= t[j]));
        }
    }
    cout << dp[n][m];
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 896 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 34 ms 31884 KB Output is correct
18 Correct 37 ms 31992 KB Output is correct
19 Correct 37 ms 31864 KB Output is correct
20 Correct 39 ms 31864 KB Output is correct
21 Correct 33 ms 30720 KB Output is correct
22 Correct 38 ms 31744 KB Output is correct
23 Correct 32 ms 31736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 34 ms 31884 KB Output is correct
18 Correct 37 ms 31992 KB Output is correct
19 Correct 37 ms 31864 KB Output is correct
20 Correct 39 ms 31864 KB Output is correct
21 Correct 33 ms 30720 KB Output is correct
22 Correct 38 ms 31744 KB Output is correct
23 Correct 32 ms 31736 KB Output is correct
24 Runtime error 4 ms 896 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 34 ms 31884 KB Output is correct
18 Correct 37 ms 31992 KB Output is correct
19 Correct 37 ms 31864 KB Output is correct
20 Correct 39 ms 31864 KB Output is correct
21 Correct 33 ms 30720 KB Output is correct
22 Correct 38 ms 31744 KB Output is correct
23 Correct 32 ms 31736 KB Output is correct
24 Runtime error 4 ms 896 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 34 ms 31884 KB Output is correct
18 Correct 37 ms 31992 KB Output is correct
19 Correct 37 ms 31864 KB Output is correct
20 Correct 39 ms 31864 KB Output is correct
21 Correct 33 ms 30720 KB Output is correct
22 Correct 38 ms 31744 KB Output is correct
23 Correct 32 ms 31736 KB Output is correct
24 Runtime error 4 ms 896 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 896 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 896 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -