Submission #1228108

#TimeUsernameProblemLanguageResultExecution timeMemory
1228108arkanefuryExhibition (JOI19_ho_t2)C++20
0 / 100
1 ms584 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define lb lower_bound
#define F first
#define S second
#define sz size()
#define int long long
#define all(v) v.begin(),v.end()
#define FOR1(x, n) for(int j = x; j <= n; j ++)
#define FOR(x, n, m, d) for(int x = n; x <= m; x += d)
#define FORR(x, n, m, d) for(int x = n; x >= m; x -= d)
#define nikita ios_base::sync_with_stdio(0), cin.tie(0);
const int N = 5500+5;
int a[N], b[N], pref[N], d[N],ans, inf = 1e18, par = 0, c[N], dp[N][N], suf[N];
int n,m,k,sum=0,x,y, r, cnt, l, mod = 1e9+7;
vector<int>g[N];
void solve() {
	nikita
	cin >> n >> m;
	vector<pair<int,int>>v;
	FOR(i, 1, n, 1){
	    cin >> x >> y;
	    v.pb({y, x});
	}
	sort(all(v));
	FOR(i,1 , m, 1)cin >> a[i];
	sort(a+1, a+m+1);
	FOR(i, 1, n, 1){
	    FOR(j, 1, m, 1){
	        if(v[i-1].S <= a[j])dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1 );
	    }
	}
	cout << dp[n][m];
}
signed main(){
	nikita
	int tt = 1;
	if(!tt)cin >> tt;
	FOR(i, 1, tt, 1)solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...