# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
375793 | 2021-03-10T02:19:22 Z | daniel920712 | Two Dishes (JOI19_dishes) | C++14 | 359 ms | 74440 KB |
#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; long long all1[1000005],Time1[1000005],how1[1000005]; long long all2[1000005],Time2[1000005],how2[1000005]; long long pre1[1000005]={0}; long long pre2[1000005]={0}; bool have[2005][2005]; long long DP[2005][2005]={0}; long long N,M; long long F(long long x,long long y) { long long a=0,b=0; if(x==N&&y==M) return 0; if(have[x][y]) return DP[x][y]; have[x][y]=1; if(x==N) { DP[x][y]=F(x,y+1); if((pre1[x]+pre2[y+1])<=Time2[y]) DP[x][y]+=how2[y]; } else if(y==M) { DP[x][y]=F(x+1,y); if((pre1[x+1]+pre2[y])<=Time1[x]) DP[x][y]+=how1[x]; } else { a=F(x,y+1); if((pre1[x]+pre2[y+1])<=Time2[y]) a+=how2[y]; b=F(x+1,y); if((pre1[x+1]+pre2[y])<=Time1[x]) b+=how1[x]; DP[x][y]=max(a,b); } return DP[x][y]; } int main() { long long ans=-1e18,i; scanf("%lld %lld",&N,&M); for(i=0;i<N;i++) { scanf("%lld %lld %lld",&all1[i],&Time1[i],&how1[i]); pre1[i+1]=pre1[i]+all1[i]; } for(i=0;i<M;i++) { scanf("%lld %lld %lld",&all2[i],&Time2[i],&how2[i]); pre2[i+1]=pre2[i]+all2[i]; } printf("%lld\n",F(0,0)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 359 ms | 64108 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 1 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 492 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 1 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 492 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 492 KB | Output is correct |
17 | Correct | 186 ms | 36076 KB | Output is correct |
18 | Correct | 200 ms | 36204 KB | Output is correct |
19 | Correct | 193 ms | 36204 KB | Output is correct |
20 | Correct | 185 ms | 36204 KB | Output is correct |
21 | Correct | 183 ms | 34796 KB | Output is correct |
22 | Correct | 193 ms | 36204 KB | Output is correct |
23 | Correct | 195 ms | 36204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 1 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 492 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 492 KB | Output is correct |
17 | Correct | 186 ms | 36076 KB | Output is correct |
18 | Correct | 200 ms | 36204 KB | Output is correct |
19 | Correct | 193 ms | 36204 KB | Output is correct |
20 | Correct | 185 ms | 36204 KB | Output is correct |
21 | Correct | 183 ms | 34796 KB | Output is correct |
22 | Correct | 193 ms | 36204 KB | Output is correct |
23 | Correct | 195 ms | 36204 KB | Output is correct |
24 | Incorrect | 347 ms | 74440 KB | Output isn't correct |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 1 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 492 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 492 KB | Output is correct |
17 | Correct | 186 ms | 36076 KB | Output is correct |
18 | Correct | 200 ms | 36204 KB | Output is correct |
19 | Correct | 193 ms | 36204 KB | Output is correct |
20 | Correct | 185 ms | 36204 KB | Output is correct |
21 | Correct | 183 ms | 34796 KB | Output is correct |
22 | Correct | 193 ms | 36204 KB | Output is correct |
23 | Correct | 195 ms | 36204 KB | Output is correct |
24 | Incorrect | 347 ms | 74440 KB | Output isn't correct |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 1 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 492 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 492 KB | Output is correct |
17 | Correct | 186 ms | 36076 KB | Output is correct |
18 | Correct | 200 ms | 36204 KB | Output is correct |
19 | Correct | 193 ms | 36204 KB | Output is correct |
20 | Correct | 185 ms | 36204 KB | Output is correct |
21 | Correct | 183 ms | 34796 KB | Output is correct |
22 | Correct | 193 ms | 36204 KB | Output is correct |
23 | Correct | 195 ms | 36204 KB | Output is correct |
24 | Incorrect | 347 ms | 74440 KB | Output isn't correct |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 359 ms | 64108 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 359 ms | 64108 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |