#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll MAXN = 1e5 + 5;
const ll MAX = 1e18;
ll n, m, bingkai[MAXN], suffMax[MAXN];
pll arr[MAXN];
// {Value, Space}
ll query(ll l, ll r) {
ll out = 0;
for (int i = l; i <= r; ++i)
{
out = max(out, arr[i].second);
}
return out;
}
int main(){
cin >> n >> m;
for (int i = 1; i <= n; ++i)
{
cin >> arr[i].second >> arr[i].first;
}
sort(arr+1, arr+n+1);
for (int i = 1; i <= m; ++i)
{
cin >> bingkai[i];
}
sort(bingkai+1, bingkai+1+m);
ll idxa = 1, idxb = 1;
while(idxb <= n)
{
pll now = arr[idxa];
// {Value, Space}
ll len = idxb-idxa+1;
ll serch = query(idxa, idxb);
ll idx = lower_bound(bingkai+1, bingkai+1+n, serch) - (bingkai+1);
ll lennow = n - idx;
if (lennow >= len)
{
len = max(len, lennow);
}
if (idxa == idxb)
{
idxb++;
} else if (idxb == n) {
idxa++;
} else {
if (lennow >= len) {
idxb++;
} else {
idxa++;
}
}
}
cout << "0\n";
return 0;
}
Compilation message
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:40:9: warning: variable 'now' set but not used [-Wunused-but-set-variable]
40 | pll now = arr[idxa];
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
264 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
264 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
264 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |