#include <bits/stdc++.h>
using namespace std;
#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = ll(4e15) + ll(2e15);
const double EPS = 1e-9;
static int LamyIsCute = []() {
EmiliaMyWife
return 48763;
}();
signed main() {
int n, m;
cin >> n >> m;
vector<pair<int, int>> arr(n);
for(auto &[v, s] : arr)
cin >> s >> v;
sort(arr.begin(), arr.end());
vector<int> brr(m);
for(int &a : brr)
cin >> a;
sort(brr.begin(), brr.end());
set<int> has, used;
for(int i = 0; i < m; i++)
has.insert(i);
for(const auto &[_, s] : arr) {
int it = lower_bound(brr.begin(), brr.end(), s) - brr.begin();
auto iter = has.lower_bound(it);
if(iter == has.end())
continue;
auto iter2 = used.lower_bound(*iter);
if(iter2 != used.end()) {
has.insert(*iter2);
used.erase(iter2);
}
used.insert(*iter);
has.erase(iter);
}
cout << used.size() << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |