Submission #927240

# Submission time Handle Problem Language Result Execution time Memory
927240 2024-02-14T13:45:28 Z Gromp15 Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 504 KB
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define db double
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rint(l, r) uniform_int_distribution<int>(l, r)(rng)
template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
void test_case() {
	int n, m;
	cin >> n >> m;
	vector<ar<int, 2>> a(n);
	for (auto &x : a) cin >> x[0] >> x[1];
	vector<int> s(m);
	for (int &x : s) cin >> x;
	sort(all(a));
	sort(all(s));
	int ans = 0;
	for (int mask = 0; mask < 1 << n; mask++) {
		vector<ar<int, 2>> cur;
		for (int i = 0; i < n; i++) if (mask >> i & 1) cur.push_back(a[i]);
		bool ok = 1;
		for (int i = 1; i < sz(cur); i++) {
			if (cur[i][0] < cur[i-1][0] || cur[i][1] < cur[i-1][1]) {
				ok = 0;
				break;
			}
		}
		if (ok) {
			for (int i = 0; i < sz(cur); i++) {
				int cnt = 0;
				for (int x : s) cnt += x >= cur[i][0];
				if (cnt < sz(cur) - i) {
					ok = 0;
					break;
				}
			}
			if (ok) ckmax(ans, sz(cur));
		}
	}
	cout << ans << '\n';


}
int main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
//    cin >> t;
    while (t--) test_case();
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 1 ms 504 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 1 ms 504 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 1 ms 504 KB Output isn't correct
6 Halted 0 ms 0 KB -