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>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
struct painting{
int v;
int s;
};
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,m;cin>>n>>m;
vector<painting> arr(n);
for(int i=0;i<n;i++) cin>>arr[i].s>>arr[i].v;
sort(arr.begin(),arr.end(),[&](const painting &a,const painting &b){return (a.v==b.v)?(a.s<b.s):(a.v<b.v);});
vector<int> frame(m);
for(int i=0;i<m;i++) cin>>frame[i];
sort(frame.begin(),frame.end());
int bestframe[m+1]={0};
for(int i=0;i<n;i++){
int k = lower_bound(frame.begin(),frame.end(),arr[i].s)-frame.begin();
k++;
for(int j=m;j>=k;j--){
bestframe[j] = max(bestframe[j-1]+1,bestframe[j]);
}
}
cout<<bestframe[m]<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |