#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int n, m;
pair<int, int> a[maxn];
int b[maxn];
bool cmp(pair<int, int> p1, pair<int, int> p2)
{
if (p1.second == p2.second)
{
return p1.first <= p2.first;
}
return p1.second > p2.second;
}
void fastIO()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
{
fastIO();
cin >> n >> m;
for (int i = 1; i <= n; ++i)
{
cin >> a[i].first >> a[i].second;
}
for (int i = 1; i <= m; ++i)
{
cin >> b[i];
}
sort(a + 1, a + n + 1, cmp);
sort(b + 1, b + m + 1, greater<int>());
int ans = 0;
for (int i = 1; i <= n && ptr <= m; ++i)
{
if (a[i].first <= b[ans + 1])
{
++ans;
}
}
cout << ans << endl;
return 0;
}
Compilation message
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:50:31: error: 'ptr' was not declared in this scope
50 | for (int i = 1; i <= n && ptr <= m; ++i)
| ^~~