제출 #1023573

#제출 시각아이디문제언어결과실행 시간메모리
1023573vjudge1Exhibition (JOI19_ho_t2)C++17
50 / 100
1 ms856 KiB
#include <bits/stdc++.h>
#define file(name)  if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define REV(i, b, a) for(int i = (b); i >= (a); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define ll long long
#define fi first 
#define se second
#define int long long
using namespace std;
const int N = 1005;
int n, m;
pair<int, int> a[N];
int c[N];
void solve(int tc) {
    cin >> n >> m;
    FOR(i, 1, n) cin >> a[i].se >> a[i].fi;
    FOR(i, 1, m) cin >> c[i];
    sort(a + 1, a + n + 1);
    sort(c + 1, c + m + 1);
    int ans = 0, j = m;
    for(int i = n; i >= 1 && j >= 1; --i) {
        if(c[j] >= a[i].se) {
            ++ans;
            --j;
        }
    }
    cout << ans << '\n';
    return;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int tc = 1; 
    // cin >> tc;
    for(int i = 1; i <= tc; ++i) solve(tc);
    return (0);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...