제출 #464244

#제출 시각아이디문제언어결과실행 시간메모리
464244wdjpngCloud Computing (CEOI18_clo)C++17
0 / 100
1 ms292 KiB
#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 (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[i] - v[i]); } } cout << dp[n-1][m-1] << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...