# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
530564 |
2022-02-25T20:31:04 Z |
pedroslrey |
Hotel (CEOI11_hot) |
C++17 |
|
2011 ms |
11004 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3276 KB |
Output is correct |
2 |
Correct |
2 ms |
2500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
4812 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
328 ms |
11004 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
155 ms |
10996 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
765 ms |
10972 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2011 ms |
10924 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
661 ms |
10988 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
314 ms |
10996 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |