답안 #99557

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99557 2019-03-05T04:42:54 Z DrumpfTheGodEmperor Exhibition (JOI19_ho_t2) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5;
int n, m, c[N];
struct Picture { int s, v; } p[N];
bool cmp1(const Picture &lhs, const Picture &rhs) { return lhs.s < rhs.s; }
bool cmp2(const Picture &lhs, const Picture &rhs) { return lhs.v < rhs.v; }
bool check(int x) {
	if (!x) return 1;
	int cur = x - 1;
	fw (i, 0, n) {
		if (cur < 0) break;
		if (p[i].s <= c[cur]) cur--;
	}
	return (cur < 0);
}
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	fw (i, 0, n) cin >> p[i].s >> p[i].v;
	sort(p, p + n, cmp2);
//	reverse(p, p + n);
	fw (i, 0, m) cin >> c[i];
	sort(c, c + m);
	reverse(c, c + m);
	int l = 0, r = min(n, m);
	while (l < r) {
		int m = (l + r) >> 1;
		if (check(m + 1)) l = m + 1;
		else r = m;
	}
	cout << l;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -