Submission #1275371

#TimeUsernameProblemLanguageResultExecution timeMemory
1275371MisterReaperExhibition (JOI19_ho_t2)C++20
100 / 100
35 ms1608 KiB
// File exhibition.cpp created on 02.10.2025 at 11:14:16
#include <bits/stdc++.h>

using i64 = long long;

#ifdef DEBUG 
    #include "/home/ahmetalp/Desktop/Workplace/debug.h"
#else
    #define debug(...) void(23)
#endif

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

    int N, M;
    std::cin >> N >> M;

    std::vector<std::array<int, 2>> A(N);
    std::vector<int> B(M);
    for (int i = 0; i < N; ++i) {
        std::cin >> A[i][1] >> A[i][0];
    }
    for (int i = 0; i < M; ++i) {
        std::cin >> B[i];
    }

    std::sort(A.begin(), A.end());
    std::sort(B.begin(), B.end());

    int p = M - 1;
    for (int i = N - 1; i >= 0; --i) {
        if (p == -1) {
            break;
        }
        if (A[i][1] <= B[p]) {
            p--;
        }
    }

    std::cout << M - p - 1 << '\n';

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...