Submission #526382

# Submission time Handle Problem Language Result Execution time Memory
526382 2022-02-14T14:10:00 Z bebecanvas Exhibition (JOI19_ho_t2) C++14
0 / 100
17 ms 328 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long
#define endl '\n'
#define sz(x) (int) (x).size()

int n, m;
pair<int, int> p[100005];
int f[100005];
int dp(int i, int j, int k){
	if(i==n||j==m){return 0;}
	if(p[i].second>=k&&p[i].first<=f[j]){
		return max(dp(i+1, j+1, p[i].second)+1, max(dp(i, j+1, k), dp(i+1,j, k)));
	}else{
		return max(dp(i, j+1, k), dp(i+1,j, k));
	}
}

signed main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> m;
	for(int i=0; i<n; i++){
		int a, b; cin >> a >> b;
		p[i]= make_pair(a, b);
	}
	for(int i=0; i<m; i++){cin >> f[i];}
	sort(f, f+m);
	sort(p, p+n);
	
	int ans= dp(0, 0, -1);
	
	cout << ans << endl;
	
	
	
}






# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 17 ms 324 KB Output is correct
3 Correct 15 ms 328 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 17 ms 324 KB Output is correct
3 Correct 15 ms 328 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 17 ms 324 KB Output is correct
3 Correct 15 ms 328 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -