Submission #572047

# Submission time Handle Problem Language Result Execution time Memory
572047 2022-06-03T12:20:53 Z 1ne Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 320 KB
#include<bits/stdc++.h>
using namespace std;
const long long mxn = 1e12;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m;cin>>n>>m;
	vector<pair<long long ,long long>>arr(n);
	for (int i = 0;i<n;++i){
		cin>>arr[i].first>>arr[i].second;
	}
	vector<int>brr(m);
	for (int i = 0;i<m;++i)cin>>brr[i];
	sort(brr.begin(),brr.end());
	sort(arr.begin(),arr.end(),[&](auto x,auto y){
		return x.second < y.second;
	});
	
	function<int(int,int)> solve = [&](int cur,int pos){
		if (cur==n)return 0;
		int nxt = lower_bound(brr.begin(),brr.end(),arr[cur].first) - brr.begin();
		nxt = max(nxt,pos);
		int ans = 0;
		ans = solve(cur + 1,pos);
		if (nxt!=m){
			ans = max(ans,solve(cur + 1,nxt + 1) + 1);
		}
		return ans;
	};
	int ans = solve(0,0);
	cout<<ans<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 320 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 320 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 320 KB Output isn't correct
4 Halted 0 ms 0 KB -