Submission #930588

# Submission time Handle Problem Language Result Execution time Memory
930588 2024-02-20T07:31:26 Z aykhn Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    int b[m];
    array<int, 2> a[n];
    multiset<int> s;
    for (array<int, 2> &x : a) cin >> x[0] >> x[1], s.insert(x[1]);
    for (int &i : b) cin >> i;
    sort(b, b + m);
    sort(a, a + n);
    int j = n - 1, res = 0;
    for (int i = m - 1; i >= 0; i--)
    {
        while (j >= 0 && b[i] < a[j][0]) 
        {
            if (s.find(a[j][1]) != s.end()) s.erase(s.find(a[j][1]));
            j--;
        }
        if (!s.empty()) res++, s.erase(--s.end());
    }
    cout << res << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -