Submission #572262

#TimeUsernameProblemLanguageResultExecution timeMemory
572262PiejanVDCExhibition (JOI19_ho_t2)C++17
50 / 100
288 ms274432 KiB
#include <bits/stdc++.h> using namespace std; signed main() { int n,m; cin>>n>>m; vector<pair<int,int>>v(n); for(auto &z : v) { cin>>z.second>>z.first; } sort(v.begin(),v.end()); vector<int>c(m); for(auto &z : c) { cin>>z; } sort(c.begin(),c.end()); int dp[n+5][m+5]; for(int i = 0 ; i <= n ; i++) { for(int j = 0 ; j <= m ; j++) { dp[i][j] = 0; } } int ans = 0; for(int i = 1 ; i <= n ; i++) { for(int j = 1 ; j <= m ; j++) { dp[i][j] = dp[i][j-1]; dp[i][j] = max(dp[i][j], dp[i-1][j]); if(v[i-1].second <= c[j-1]) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1); ans = max(ans, dp[i][j]); } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...