# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
572251 | PiejanVDC | Exhibition (JOI19_ho_t2) | C++17 | 1 ms | 304 KiB |
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;
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 ans = 0;
int dp[n+5][m+5];
for(int i = 0 ; i <= m ; i++)
dp[0][i] = 0;
for(int i = 0 ; i <= n ; i++)
dp[i][0] = 0;
for(int i = 1 ; i <= n ; i++) {
for(int j = 1 ; j <= m ; j++) {
dp[i][j] = dp[i][j-1];
if(v[i-1].second <= c[j-1])
dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
}
}
cout << dp[n][m];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |