Submission #531996

# Submission time Handle Problem Language Result Execution time Memory
531996 2022-03-02T03:11:00 Z rk42745417 Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 296 KB
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = ll(4e15) + ll(2e15);
const double EPS = 1e-9;
static int LamyIsCute = []() {
	EmiliaMyWife
	return 48763;
}();

signed main() {
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> arr(n);

	for(auto &[v, s] : arr)
		cin >> s >> v;
	sort(arr.begin(), arr.end());
	
	vector<int> brr(m);
	for(int &a : brr)
		cin >> a;
	sort(brr.begin(), brr.end());

	set<int> has, used;
	for(int i = 0; i < m; i++)
		has.insert(i);
	for(const auto &[_, s] : arr) {
		int it = lower_bound(brr.begin(), brr.end(), s) - brr.begin();
		auto iter = has.lower_bound(it);
		if(iter == has.end())
			continue;
		auto iter2 = used.lower_bound(*iter);
		if(iter2 != used.end()) {
			has.insert(*iter2);
			used.erase(iter2);
		}
		used.insert(*iter);
		has.erase(iter);
	}
	cout << used.size() << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 296 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 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 296 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 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 296 KB Output isn't correct
6 Halted 0 ms 0 KB -