# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
123275 | 2019-07-01T04:42:19 Z | 구재현(#3026) | Two Dishes (JOI19_dishes) | C++14 | 19 ms | 1144 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2006; const int mod = 1e9 + 7; using lint = long long; using pi = pair<int, int>; int n, m; lint a[MAXN], s[MAXN], p[MAXN]; lint b[MAXN], t[MAXN], q[MAXN]; int da[MAXN], db[MAXN]; lint dp[MAXN]; vector<pi> v[MAXN]; int main(){ scanf("%d %d",&n,&m); for(int i=1; i<=n; i++){ scanf("%lld %lld %lld",&a[i],&s[i],&p[i]); a[i] += a[i-1]; } for(int i=1; i<=m; i++){ scanf("%lld %lld %lld",&b[i],&t[i],&q[i]); b[i] += b[i-1]; } for(int i=1; i<=n; i++){ da[i] = upper_bound(b, b + m + 1, s[i] - a[i]) - b; if(da[i] > 0) v[i].emplace_back(da[i] - 1, p[i]); } lint ret = 0; for(int i=1; i<=m; i++){ db[i] = upper_bound(a, a + n + 1, t[i] - b[i]) - a; if(db[i] > 0){ v[db[i]].emplace_back(i - 1, -q[i]); ret += q[i]; } } fill(dp + 1, dp + m + 1, -1e18); for(int i=0; i<=n; i++){ for(auto &j : v[i]){ for(int k = 0; k <= j.first; k++) dp[k] += j.second; } for(int k=1; k<=m; k++) dp[k] = max(dp[k], dp[k-1]); } cout << ret + dp[m] << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 372 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 380 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 372 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 380 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 17 ms | 704 KB | Output is correct |
18 | Correct | 19 ms | 696 KB | Output is correct |
19 | Correct | 19 ms | 632 KB | Output is correct |
20 | Correct | 17 ms | 632 KB | Output is correct |
21 | Correct | 19 ms | 632 KB | Output is correct |
22 | Correct | 19 ms | 632 KB | Output is correct |
23 | Correct | 19 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 372 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 380 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 17 ms | 704 KB | Output is correct |
18 | Correct | 19 ms | 696 KB | Output is correct |
19 | Correct | 19 ms | 632 KB | Output is correct |
20 | Correct | 17 ms | 632 KB | Output is correct |
21 | Correct | 19 ms | 632 KB | Output is correct |
22 | Correct | 19 ms | 632 KB | Output is correct |
23 | Correct | 19 ms | 632 KB | Output is correct |
24 | Runtime error | 3 ms | 1144 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 372 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 380 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 17 ms | 704 KB | Output is correct |
18 | Correct | 19 ms | 696 KB | Output is correct |
19 | Correct | 19 ms | 632 KB | Output is correct |
20 | Correct | 17 ms | 632 KB | Output is correct |
21 | Correct | 19 ms | 632 KB | Output is correct |
22 | Correct | 19 ms | 632 KB | Output is correct |
23 | Correct | 19 ms | 632 KB | Output is correct |
24 | Runtime error | 3 ms | 1144 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 372 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 380 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 17 ms | 704 KB | Output is correct |
18 | Correct | 19 ms | 696 KB | Output is correct |
19 | Correct | 19 ms | 632 KB | Output is correct |
20 | Correct | 17 ms | 632 KB | Output is correct |
21 | Correct | 19 ms | 632 KB | Output is correct |
22 | Correct | 19 ms | 632 KB | Output is correct |
23 | Correct | 19 ms | 632 KB | Output is correct |
24 | Runtime error | 3 ms | 1144 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |