This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define INV_2 499122177
#define INF 1000000000
#define PI 3.14159265358979323846
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
using namespace std;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n, m;
cin >> n >> m;
pair<int, int>a[n];
for(int i = 0; i < n; i++)
cin >> a[i].second >> a[i].first;
int b[m];
for(int i = 0; i < m; i++)
cin >> b[i];
sort(a, a+n);
sort(b, b+m);
int idx=m-1;
int ans=0;
for(int i = n-1; i >= 0; i--)
{
if(idx >= 0 && a[i].second <= b[idx])
{
idx--;
ans++;
}
}
cout << ans << '\n';
}
//07-02-46
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |