Submission #530564

#TimeUsernameProblemLanguageResultExecution timeMemory
530564pedroslreyHotel (CEOI11_hot)C++17
30 / 100
2011 ms11004 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e2 + 10; int dp[MAXN][MAXN][MAXN]; pair<int, int> 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...