#include <bits/stdc++.h>
using namespace std;
const int mxsz = 1e5 + 7;
int n, m, s[mxsz], v[mxsz], c[mxsz], an;
bool cmp (int i, int j) {
return c[i] > c[j];
}
bool comp (int i, int j) {
if (s[i] == s[j]) {
return v[i] < v[j];
}
return s[i] < s[j];
}
int find (int x, int p) {
while (p <= n+1 && s[p++] > x);
return p - 1;
}
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> s[i] >> v[i];
}
for (int i = 1; i <= m; i++) {
cin >> c[i];
}
sort(s + 1, s + n + 1, comp);
sort(c + 1, c + n + 1, cmp);
int po = 1, pos = 1;
for (int i = 1; i <= m; i++) {
pos = find(c[i], po);
po = pos;
if (po == n+1) {
break;
} po++, an++;
}
cout << an;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |