# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123284 | 2019-07-01T05:44:04 Z | 김세빈(#3018) | Two Dishes (JOI19_dishes) | C++14 | 4 ms | 760 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll A[2020], S[2020], P[2020]; ll B[2020], T[2020], Q[2020]; ll D[2020][2020]; ll n, m; int main() { ll i, j; scanf("%lld%lld", &n, &m); for(i=1; i<=n; i++){ scanf("%lld%lld%lld", A + i, S + i, P + i); A[i] += A[i - 1]; } for(i=1; i<=m; i++){ scanf("%lld%lld%lld", B + i, T + i, Q + i); B[i] += B[i - 1]; } for(i=1; i<=n; i++){ S[i] = upper_bound(B, B + m + 1, S[i] - A[i]) - B; } for(i=1; i<=m; i++){ T[i] = upper_bound(A, A + n + 1, T[i] - B[i]) - A; } for(i=0; i<=n; i++){ for(j=0; j<=m; j++){ if(i || j) D[i][j] = -1e18; if(j) D[i][j] = max(D[i][j], D[i][j - 1] + (i < T[j] ? Q[j] : 0)); if(i) D[i][j] = max(D[i][j], D[i - 1][j] + (j < S[i] ? P[i] : 0)); printf("%lld ", D[i][j]); } printf("\n"); } printf("%lld\n", D[n][m]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4 ms | 760 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4 ms | 760 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4 ms | 760 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |