Submission #123359

# Submission time Handle Problem Language Result Execution time Memory
123359 2019-07-01T08:23:40 Z 송준혁(#3022) Two Dishes (JOI19_dishes) C++14
0 / 100
8 ms 1144 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int N, M;
LL A[2020], S[2020], P[2020];
LL B[2020], T[2020], Q[2020];
int D[2020][2020];

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=0; i<=N; i++) for (int j=0; j<=M; j++) D[i][j] = max(D[i-1][j] + ((A[i]+B[j] <= S[i]) ? P[i] : 0), D[i][j-1] + ((A[i]+B[j] <= T[j]) ? Q[j] : 0));
    printf("%d\n", D[N][M]);
    return 0;
}

Compilation message

dishes.cpp: In function 'int main()':
dishes.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~~
dishes.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld %lld", &A[i], &S[i], &P[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dishes.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld %lld", &B[i], &T[i], &Q[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
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 Runtime error 8 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -