Submission #475759

# Submission time Handle Problem Language Result Execution time Memory
475759 2021-09-24T02:59:18 Z thiago_bastos Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 312 KB
#include "bits/stdc++.h"

using namespace std;

using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned;
using i16 = short;
using u16 = unsigned short;
using ld = long double;
using ii = pair<int, int>;

void solve() {

	int n, m;
	
	cin >> n >> m;
	
	vector<ii> a(n);
	vector<int> c(m), p(m, 0);
	
	for(auto& [x, y] : a) cin >> x >> y;
	for(int& x : c) cin >> x;
	
	sort(a.begin(), a.end());
	sort(c.begin(), c.end());
	
	for(int i = n - 1; i >= 0; --i) {
		int k = lower_bound(p.begin(), p.end(), a[i].second) - p.begin() - 1;
		if(k < 0) continue;
		else if(c[k] >= a[i].first || p[k]) p[k] = a[i].second;
	}

	int cur = m;
	while(cur > 0 && p[cur - 1] > 0) --cur;
	cout << m - cur << '\n';
}   

int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t--) solve();
 	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -