#include <bits/stdc++.h>
#define ll long long
#define rep(a,b,c) for(int a=b; a<c; a++)
#define fi first
#define se second
#define pii pair<int, int>
using namespace std;
int main(){
int n, m;
cin>>n>>m;
pii pic[n];
int frame[n], dp[m]{}, ans=0;
rep(i,0,n) cin>>pic[i].se>>pic[i].fi;
sort(pic,pic+n);
rep(i,0,m) cin>>frame[i];
sort(frame,frame+n);
rep(i,0,n){
int mx=0;
rep(j,0,m){
if(dp[j]>mx) mx=max(dp[j],mx);
else if(frame[j]>=pic[i].se)dp[j]=max(dp[j],mx+1);
ans=max(ans,dp[j]);
}
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Incorrect |
1 ms |
432 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Incorrect |
1 ms |
432 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Incorrect |
1 ms |
432 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |