Submission #367343

# Submission time Handle Problem Language Result Execution time Memory
367343 2021-02-16T22:51:07 Z lookcook Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// #define cerr if(false) cerr
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define endl '\n'
#define ld long double
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(x) (x).begin(), (x).end()

const int maxn = 100500;

int n, m;
pii a[maxn];

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m;

    for(int i = 1; i <= n; i++) {
        cin >> a[i].fi >> a[i].se;
    }

    priority_queue<int> pq;
    for(int i = 1; i <= m; i++) {
        int x;
        cin >> x;

        pq.push(-x);
    }

    sort(a+1, a+n+1);

    int lst = -1e18;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if(a[i].se >= lst) {
            while(sz(pq) and -pq.top() < a[i].fi) pq.pop();

            if(sz(pq)) {
                pq.pop();
                ans++;
                lst = a[i].fi;
            }
        }
    }

    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -