제출 #522646

#제출 시각아이디문제언어결과실행 시간메모리
522646ddy888Exhibition (JOI19_ho_t2)C++17
100 / 100
50 ms5632 KiB
#undef _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long 
#define pb push_back
#define fi first
#define si second
#define ar array
typedef pair<int,int> pi;
typedef tuple<int,int,int> ti;  
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int N, M, ans;
int frame[100010];
pi pic[100010];

signed main() {
    fast;
    cin >> N >> M;
    for (int i = 1; i <= N; ++i) cin >> pic[i].fi >> pic[i].si;
    for (int i = 1; i <= M; ++i) cin >> frame[i];
    sort(frame + 1, frame + 1 + M, greater<int>());
    sort(pic + 1, pic + 1 + N, [](pi a, pi b) {
        if (a.si == b.si) return a.fi > b.fi;
        return a.si > b.si;
    });
    int idx = 1;
    for (int i = 1; i <= M; ++i) {
        while (idx <= N && pic[idx].fi > frame[i]) ++idx;
        if (idx == N + 1) break;
        ++ans; ++idx;
    }
    cout << ans;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...