This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 pll pair<int, int>
using namespace std;
int main(){
ll n, m;
cin>>n>>m;
pll pic[n];
ll 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+m);
rep(i,0,n){
ll mx=0, mx2=0;
rep(j,0,m){
mx2=max(mx,dp[j]);
if(frame[j]>=pic[i].se)dp[j]=max(dp[j],mx+1);
mx=max(mx,mx2);
ans=max(ans,dp[j]);
}
}
cout<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |