#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> frames;
vector<pair<ll,ll> > pictures;
vector<ll> current;
vector<ll> previous;
int main(){
//freopen("exhibition.in","r",stdin);
ll n,m;
cin>>n>>m;
frames.resize(m);
pictures.resize(n);
for (int i = 0; i<n; i++){
cin>>pictures[i].second>>pictures[i].first;
}
sort(pictures.begin(),pictures.end());
for (int i = 0; i<m; i++){
cin>>frames[i];
}
sort(frames.begin(),frames.end());
previous.resize(m+1,0);
current.resize(m+1,0);
for (int i = 1; i<=n; i++){
//pictures
current[0]=0;
for (int j = 1; j<=m; j++){
//frames
current[j]=current[j-1];
if (pictures[i-1].second<=frames[j-1]){
current[j]=max(current[j],previous[j-1]+1);
}
}
previous=current;
}
cout<<previous[m]<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
252 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
252 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
252 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |