# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
721013 |
2023-04-10T04:53:35 Z |
Pring |
Exhibition (JOI19_ho_t2) |
C++14 |
|
1 ms |
1876 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
const int MXN = 100005;
int n, m, fr[MXN], dp[MXN], lastC, ans, pre[MXN];
struct P {
int sz, val;
P() {
sz = 0;
val = 0;
}
P(int _sz, int _val) {
sz = _sz;
val = _val;
}
} pic[MXN];
bool solve(int k) {
int ptr = k - 1;
for (int i = 0; i < n; i++) {
if (pic[i].sz <= fr[ptr]) {
if (--ptr == -1) return true;
}
}
return false;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> pic[i].sz >> pic[i].val;
for (int i = 0; i < m; i++) cin >> fr[i];
sort(pic, pic + n, [](P &a, P &b) {
return (a.val == b.val ? a.sz < b.sz : a.val < b.val);
});
sort(fr, fr + m, greater<int>());
int l = 0, r = m;
while (l + 1 < r) {
int mid = (l + r) >> 1;
(solve(mid) ? l : r) = mid;
}
cout << l << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1876 KB |
Output is correct |
2 |
Incorrect |
1 ms |
1876 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1876 KB |
Output is correct |
2 |
Incorrect |
1 ms |
1876 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1876 KB |
Output is correct |
2 |
Incorrect |
1 ms |
1876 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |