Submission #464271

# Submission time Handle Problem Language Result Execution time Memory
464271 2021-08-12T16:04:50 Z wdjpng Global Warming (CEOI18_glo) C++17
0 / 100
110 ms 19360 KB
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i<n; i++)
#define all(a) a.begin(), a.end()
using namespace std;

signed main()
{
    int n,m,x;
    cin>>n;
    int f[n], v[n];
    rep(i,n) cin >> x >> f[i] >> v[i];
    cin>>m;
    int F[m], V[m];
    rep(i,m) cin >> x >> F[i] >> V[i];

    int dp[n][m];
    rep(i,n) {
        rep(j,m) {
            dp[i][j] = 0;
            if(f[i]>=F[j]) dp[i][j] = max(dp[i][j], V[j] - v[i]);
            if (i>0) dp[i][j] = max(dp[i][j], dp[i-1][j]);
            if (j>0) dp[i][j] = max(dp[i][j], dp[i][j-1]);
            if(i>0&&j>0&&f[i]>=F[j]) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + V[j] - v[i]);
        }
    }

    cout << dp[n-1][m-1] << "\n";
}   
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 19360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 4960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 8872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -