#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
#define int long long
const int maxn = 1e5 + 69;
int n, m, s[maxn], v[maxn], c[maxn];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt = 1;
//cin >> tt;
while(tt--) {
cin >> n >> m;
for(int i = 0;i < n;i++)
cin >> s[i] >> v[i];
for(int i = 0;i < m;i++)
cin >> c[i];
sort(c, c + m);
vector<int> p(m);
for(int i = 0;i < n;i++) {
auto u = lower_bound(c, c + m, s[i]) - c;
if(u != m) {
++p[u];
p[u] = min(p[u], m);
}
}
for(int i = 1;i < m;i++)
p[i] += p[i - 1];
int ans = 0;
for(int i = m - 1;i >= 0;i--) {
if(p[i] >= m - i)
ans = m - i;
}
cout << ans << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |