Submission #391333

# Submission time Handle Problem Language Result Execution time Memory
391333 2021-04-18T15:17:06 Z timmyfeng Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 100000;

array<int, 2> pics[N];
int frames[N], lis[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    cin >> n >> m;

    for (int i = 0; i < n; ++i) {
        auto &[s, v] = pics[i];
        cin >> s >> v;
    }
    sort(pics, pics + n);

    for (int i = 0; i < m; ++i) {
        cin >> frames[i];
    }
    sort(frames, frames + m);

    int low = 0, high = m;
    while (low < high) {
        int mid = (low + high + 1) / 2;

        fill(lis, lis + mid, INT_MAX);
        for (int i = 0; i < n; ++i) {
            auto [s, v] = pics[i];
            int j = upper_bound(lis, lis + mid, v) - lis;
            if (j < mid && s <= frames[m - mid + j]) {
                lis[j] = v;
            }
        }

        if (lis[mid - 1] < INT_MAX) {
            low = mid;
        } else {
            high = mid - 1;
        }
    }

    cout << high << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Halted 0 ms 0 KB -