Submission #530565

# Submission time Handle Problem Language Result Execution time Memory
530565 2022-02-25T20:33:13 Z pedroslrey Hotel (CEOI11_hot) C++14
40 / 100
1940 ms 21632 KB
#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 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 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5964 KB Output is correct
2 Correct 2 ms 4556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9096 KB Output is correct
2 Correct 4 ms 9156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 319 ms 21492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 140 ms 21556 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 763 ms 21536 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1940 ms 21600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 626 ms 21512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 312 ms 21632 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -