# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
152970 | 2019-09-11T01:55:10 Z | username | Two Dishes (JOI19_dishes) | C++14 | 73 ms | 16504 KB |
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 2e3+5; int n, m; ll a[maxn]; ll b[maxn]; ll p[maxn]; ll q[maxn]; ll s[maxn]; ll t[maxn]; int dp[maxn][maxn]; int solve(int x, int y) { if(x == n && y == m) return 0; if(dp[x][y] != -1) return dp[x][y]; int best = -1e9; if(x< n) best = max(best, (a[x+1]+b[y]<= s[x+1])+solve(x+1, y)); if(y< m) best = max(best, (a[x]+b[y+1]<= t[y+1])+solve(x, y+1)); return dp[x][y] = best; } int main() { memset(dp, -1, sizeof dp); scanf("%d %d", &n, &m); for(int i = 1; i<= n; i++) scanf("%lld %lld %lld", &a[i], &s[i], &p[i]); for(int i = 1; i<= m; i++) scanf("%lld %lld %lld", &b[i], &t[i], &q[i]); for(int i = 1; i<= n; i++) a[i] += a[i-1]; for(int i = 1; i<= m; i++) b[i] += b[i-1]; printf("%d\n", solve(0, 0)); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 20 ms | 16140 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 15992 KB | Output is correct |
2 | Correct | 15 ms | 15992 KB | Output is correct |
3 | Correct | 15 ms | 16120 KB | Output is correct |
4 | Correct | 18 ms | 15992 KB | Output is correct |
5 | Correct | 16 ms | 16120 KB | Output is correct |
6 | Correct | 15 ms | 16120 KB | Output is correct |
7 | Correct | 16 ms | 16120 KB | Output is correct |
8 | Correct | 24 ms | 16004 KB | Output is correct |
9 | Correct | 15 ms | 16096 KB | Output is correct |
10 | Correct | 15 ms | 16120 KB | Output is correct |
11 | Correct | 15 ms | 16120 KB | Output is correct |
12 | Correct | 15 ms | 16120 KB | Output is correct |
13 | Correct | 15 ms | 16120 KB | Output is correct |
14 | Correct | 15 ms | 15992 KB | Output is correct |
15 | Correct | 15 ms | 15992 KB | Output is correct |
16 | Correct | 15 ms | 15996 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 15992 KB | Output is correct |
2 | Correct | 15 ms | 15992 KB | Output is correct |
3 | Correct | 15 ms | 16120 KB | Output is correct |
4 | Correct | 18 ms | 15992 KB | Output is correct |
5 | Correct | 16 ms | 16120 KB | Output is correct |
6 | Correct | 15 ms | 16120 KB | Output is correct |
7 | Correct | 16 ms | 16120 KB | Output is correct |
8 | Correct | 24 ms | 16004 KB | Output is correct |
9 | Correct | 15 ms | 16096 KB | Output is correct |
10 | Correct | 15 ms | 16120 KB | Output is correct |
11 | Correct | 15 ms | 16120 KB | Output is correct |
12 | Correct | 15 ms | 16120 KB | Output is correct |
13 | Correct | 15 ms | 16120 KB | Output is correct |
14 | Correct | 15 ms | 15992 KB | Output is correct |
15 | Correct | 15 ms | 15992 KB | Output is correct |
16 | Correct | 15 ms | 15996 KB | Output is correct |
17 | Correct | 73 ms | 16464 KB | Output is correct |
18 | Correct | 73 ms | 16476 KB | Output is correct |
19 | Correct | 73 ms | 16504 KB | Output is correct |
20 | Correct | 69 ms | 16476 KB | Output is correct |
21 | Correct | 72 ms | 16376 KB | Output is correct |
22 | Correct | 72 ms | 16348 KB | Output is correct |
23 | Correct | 73 ms | 16376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 15992 KB | Output is correct |
2 | Correct | 15 ms | 15992 KB | Output is correct |
3 | Correct | 15 ms | 16120 KB | Output is correct |
4 | Correct | 18 ms | 15992 KB | Output is correct |
5 | Correct | 16 ms | 16120 KB | Output is correct |
6 | Correct | 15 ms | 16120 KB | Output is correct |
7 | Correct | 16 ms | 16120 KB | Output is correct |
8 | Correct | 24 ms | 16004 KB | Output is correct |
9 | Correct | 15 ms | 16096 KB | Output is correct |
10 | Correct | 15 ms | 16120 KB | Output is correct |
11 | Correct | 15 ms | 16120 KB | Output is correct |
12 | Correct | 15 ms | 16120 KB | Output is correct |
13 | Correct | 15 ms | 16120 KB | Output is correct |
14 | Correct | 15 ms | 15992 KB | Output is correct |
15 | Correct | 15 ms | 15992 KB | Output is correct |
16 | Correct | 15 ms | 15996 KB | Output is correct |
17 | Correct | 73 ms | 16464 KB | Output is correct |
18 | Correct | 73 ms | 16476 KB | Output is correct |
19 | Correct | 73 ms | 16504 KB | Output is correct |
20 | Correct | 69 ms | 16476 KB | Output is correct |
21 | Correct | 72 ms | 16376 KB | Output is correct |
22 | Correct | 72 ms | 16348 KB | Output is correct |
23 | Correct | 73 ms | 16376 KB | Output is correct |
24 | Execution timed out | 19 ms | 16504 KB | Time limit exceeded (wall clock) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 15992 KB | Output is correct |
2 | Correct | 15 ms | 15992 KB | Output is correct |
3 | Correct | 15 ms | 16120 KB | Output is correct |
4 | Correct | 18 ms | 15992 KB | Output is correct |
5 | Correct | 16 ms | 16120 KB | Output is correct |
6 | Correct | 15 ms | 16120 KB | Output is correct |
7 | Correct | 16 ms | 16120 KB | Output is correct |
8 | Correct | 24 ms | 16004 KB | Output is correct |
9 | Correct | 15 ms | 16096 KB | Output is correct |
10 | Correct | 15 ms | 16120 KB | Output is correct |
11 | Correct | 15 ms | 16120 KB | Output is correct |
12 | Correct | 15 ms | 16120 KB | Output is correct |
13 | Correct | 15 ms | 16120 KB | Output is correct |
14 | Correct | 15 ms | 15992 KB | Output is correct |
15 | Correct | 15 ms | 15992 KB | Output is correct |
16 | Correct | 15 ms | 15996 KB | Output is correct |
17 | Correct | 73 ms | 16464 KB | Output is correct |
18 | Correct | 73 ms | 16476 KB | Output is correct |
19 | Correct | 73 ms | 16504 KB | Output is correct |
20 | Correct | 69 ms | 16476 KB | Output is correct |
21 | Correct | 72 ms | 16376 KB | Output is correct |
22 | Correct | 72 ms | 16348 KB | Output is correct |
23 | Correct | 73 ms | 16376 KB | Output is correct |
24 | Execution timed out | 19 ms | 16504 KB | Time limit exceeded (wall clock) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 15992 KB | Output is correct |
2 | Correct | 15 ms | 15992 KB | Output is correct |
3 | Correct | 15 ms | 16120 KB | Output is correct |
4 | Correct | 18 ms | 15992 KB | Output is correct |
5 | Correct | 16 ms | 16120 KB | Output is correct |
6 | Correct | 15 ms | 16120 KB | Output is correct |
7 | Correct | 16 ms | 16120 KB | Output is correct |
8 | Correct | 24 ms | 16004 KB | Output is correct |
9 | Correct | 15 ms | 16096 KB | Output is correct |
10 | Correct | 15 ms | 16120 KB | Output is correct |
11 | Correct | 15 ms | 16120 KB | Output is correct |
12 | Correct | 15 ms | 16120 KB | Output is correct |
13 | Correct | 15 ms | 16120 KB | Output is correct |
14 | Correct | 15 ms | 15992 KB | Output is correct |
15 | Correct | 15 ms | 15992 KB | Output is correct |
16 | Correct | 15 ms | 15996 KB | Output is correct |
17 | Correct | 73 ms | 16464 KB | Output is correct |
18 | Correct | 73 ms | 16476 KB | Output is correct |
19 | Correct | 73 ms | 16504 KB | Output is correct |
20 | Correct | 69 ms | 16476 KB | Output is correct |
21 | Correct | 72 ms | 16376 KB | Output is correct |
22 | Correct | 72 ms | 16348 KB | Output is correct |
23 | Correct | 73 ms | 16376 KB | Output is correct |
24 | Execution timed out | 19 ms | 16504 KB | Time limit exceeded (wall clock) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 20 ms | 16140 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 20 ms | 16140 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |