Submission #963389

#TimeUsernameProblemLanguageResultExecution timeMemory
963389leo_2727Exhibition (JOI19_ho_t2)C++17
50 / 100
1029 ms5096 KiB
#include <algorithm> #include <fstream> #include <vector> #include <queue> #include <stack> #include <iostream> #include <cmath> #include <queue> #include <set> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <unordered_set> #include <iomanip> #define F first #define S second #define PB push_back using namespace std; const long long MOD=1e9+7, INF=1e18; const int INFI=1e9; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<pair<int, ii>> viii; typedef vector<vii> vvii; typedef vector<ll> vll; typedef vector<vll> vvll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin>>n>>m; vii p(n+1), dp(m+1, {0, 0}); vi f(m+1); for(int i=1;i<=n;i++) cin>>p[i].S>>p[i].F; for(int i=1;i<=m;i++) cin>>f[i]; sort(p.begin()+1, p.end()); sort(f.begin()+1, f.end()); for(int i=1;i<=n;i++){ int cntmx=0, ind=1, sz=p[i].S, val=p[i].F; for(;ind<=m && f[ind]<sz;ind++){} for(int j=1;j<ind;j++) if(dp[j].F>cntmx) cntmx=dp[j].F; for(;ind<=m;ind++){ int aux=dp[ind].F; if(cntmx+1>aux) dp[ind]={cntmx+1, val}; if(aux>cntmx) cntmx=aux; } } cout<<dp[m].F<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...