#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define MAXN 100005
int n, m;
pair<int, int> pics[MAXN];
vector<int> frames;
int dp[MAXN];
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i=0; i<n; i++) {
cin >> pics[i].second >> pics[i].first;
}
for (int i=0; i<m; i++) {
frames.push_back(0);
cin >> frames[i];
}
sort(frames.begin(), frames.end());
for (int i=0; i<n; i++) {
pics[i].second = lower_bound(frames.begin(), frames.end(), pics[i].second)-frames.begin();
}
sort(pics, pics+n);
dp[n] = 0;
for (int i=n-1; i>=0; i--) {
dp[i] = min(dp[i+1]+1, m-pics[i].second);
}
cout << dp[0] << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
392 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
392 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
392 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |