#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
int N, M;
vector<pair<long long, long long>> P;
vector<long long> C;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N >> M;
P.resize(N);
C.resize(M);
for (int i = 0; i < N; i++) {
cin >> P[i].s >> P[i].f;
}
for (int i = 0; i < M; i++) {
cin >> C[i];
}
sort(P.begin(), P.end());
sort(C.begin(), C.end());
int i = 0;
int j = 0;
int ans = 0;
while (i < N && j < M) {
bool flag = false;
while (P[i].s > C[j]) {
j++;
if (j == M) {
flag = true;
break;
}
}
if (flag) break;
ans++;
j++;
i++;
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |