# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
120134 | 2019-06-23T14:07:31 Z | KLPP | Two Dishes (JOI19_dishes) | C++14 | 650 ms | 151800 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int lld; typedef pair<lld,lld> pii; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) #define INF 10000000000000000 lld n,m; lld a[1000000]; lld b[1000000]; lld sa[1000000]; lld sb[1000000]; lld DP[2001][2001]; lld s[1000000]; lld t[1000000]; lld p[1000000]; lld q[1000000]; lld calc(int i, int j){ if(DP[i][j]!=-1)return DP[i][j]; DP[i][j]=-INF; if(i>0){ if(sa[i]+sb[j]<=s[i-1])DP[i][j]=max(DP[i][j],calc(i-1,j)+p[i-1]); else DP[i][j]=max(DP[i][j],calc(i-1,j)); } if(j>0){ if(sa[i]+sb[j]<=t[j-1])DP[i][j]=max(DP[i][j],calc(i,j-1)+q[j-1]); else DP[i][j]=max(DP[i][j],calc(i,j-1)); } return DP[i][j]; } int main(){ scanf("%lld %lld",&n,&m); rep(i,0,n)scanf("%lld %lld %lld",&a[i],&s[i],&p[i]); rep(i,0,m)scanf("%lld %lld %lld",&b[i],&t[i],&q[i]); sa[0]=0; sb[0]=0; rep(i,1,n+1){ sa[i]=sa[i-1]+a[i-1]; } rep(i,1,m+1){ sb[i]=sb[i-1]+b[i-1]; } rep(i,0,n+1){ rep(j,0,m+1)DP[i][j]=-1; } DP[0][0]=0; printf("%lld\n",calc(n,m)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 642 ms | 151800 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 | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 512 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 512 KB | Output is correct |
11 | Correct | 2 ms | 512 KB | Output is correct |
12 | Correct | 2 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 512 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 512 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 512 KB | Output is correct |
11 | Correct | 2 ms | 512 KB | Output is correct |
12 | Correct | 2 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 512 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 134 ms | 32212 KB | Output is correct |
18 | Correct | 66 ms | 32256 KB | Output is correct |
19 | Correct | 80 ms | 32232 KB | Output is correct |
20 | Correct | 74 ms | 32128 KB | Output is correct |
21 | Correct | 71 ms | 31036 KB | Output is correct |
22 | Correct | 76 ms | 32128 KB | Output is correct |
23 | Correct | 76 ms | 32128 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 512 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 512 KB | Output is correct |
11 | Correct | 2 ms | 512 KB | Output is correct |
12 | Correct | 2 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 512 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 134 ms | 32212 KB | Output is correct |
18 | Correct | 66 ms | 32256 KB | Output is correct |
19 | Correct | 80 ms | 32232 KB | Output is correct |
20 | Correct | 74 ms | 32128 KB | Output is correct |
21 | Correct | 71 ms | 31036 KB | Output is correct |
22 | Correct | 76 ms | 32128 KB | Output is correct |
23 | Correct | 76 ms | 32128 KB | Output is correct |
24 | Runtime error | 650 ms | 148896 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 | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 512 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 512 KB | Output is correct |
11 | Correct | 2 ms | 512 KB | Output is correct |
12 | Correct | 2 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 512 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 134 ms | 32212 KB | Output is correct |
18 | Correct | 66 ms | 32256 KB | Output is correct |
19 | Correct | 80 ms | 32232 KB | Output is correct |
20 | Correct | 74 ms | 32128 KB | Output is correct |
21 | Correct | 71 ms | 31036 KB | Output is correct |
22 | Correct | 76 ms | 32128 KB | Output is correct |
23 | Correct | 76 ms | 32128 KB | Output is correct |
24 | Runtime error | 650 ms | 148896 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 | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 512 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 512 KB | Output is correct |
11 | Correct | 2 ms | 512 KB | Output is correct |
12 | Correct | 2 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 512 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 134 ms | 32212 KB | Output is correct |
18 | Correct | 66 ms | 32256 KB | Output is correct |
19 | Correct | 80 ms | 32232 KB | Output is correct |
20 | Correct | 74 ms | 32128 KB | Output is correct |
21 | Correct | 71 ms | 31036 KB | Output is correct |
22 | Correct | 76 ms | 32128 KB | Output is correct |
23 | Correct | 76 ms | 32128 KB | Output is correct |
24 | Runtime error | 650 ms | 148896 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 642 ms | 151800 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 642 ms | 151800 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |