#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
int N, M;
vector<pair<int, int>> P;
vector<int> C;
int main() {
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";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |