Submission #530565

#TimeUsernameProblemLanguageResultExecution timeMemory
530565pedroslreyHotel (CEOI11_hot)C++14
40 / 100
1940 ms21632 KiB
#include <bits/stdc++.h> using namespace std; using lli = long long; const int MAXN = 1e2 + 10; lli dp[MAXN][MAXN][MAXN]; pair<lli, lli> xs[MAXN], ys[MAXN]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, t; cin >> n >> m >> t; for (int i = 1; i <= n; ++i) cin >> xs[i].first >> xs[i].second; for (int i = 1; i <= m; ++i) cin >> ys[i].first >> ys[i].second; sort(xs+1, xs+n+1); sort(ys+1, ys+m+1, [](pair<int, int> a, pair<int, int> b) { return a.second < b.second; }); for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) for (int z = 1; z <= t; ++z){ dp[i][j][z] = max(dp[i][j-1][z], dp[i-1][j][z]); if (xs[i].second >= ys[j].second) dp[i][j][z] = max(dp[i][j][z], dp[i-1][j-1][z-1] - xs[i].first + ys[j].first); } cout << dp[n][m][t] << endl; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...