Submission #850609

#TimeUsernameProblemLanguageResultExecution timeMemory
850609willychanExhibition (JOI19_ho_t2)C++14
50 / 100
1022 ms4672 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...