10716 | 2024-04-10 11:13:01 | kideso | Telefonközpont | cpp17 | Wrong answer 20/100 | 56ms | 17100 KiB |
// zsebi kodja debug
#include <iostream>
#include <queue>
#include <algorithm>
#define ll long long
using namespace std;
ll n, m,q;
vector<ll>x,st;
void epit(ll p, ll l, ll r) {
if (l == r) {
st[p] = x[l];
return;
}
ll k = (l + r) / 2;
epit(2*p, l, k);
epit(2*p+1, k + 1, r);
st[p] = max(st[2 * p], st[2 * p + 1]);
}
ll leker(ll p, ll l, ll r, ll a, ll b) {
if (a <= l && r <= b) {
return st[p];
}
else if (b < l || r < a)return 0;
ll k = (l + r) / 2;
return max(leker(2 * p, l, k, a, b), leker(2 * p + 1, k + 1, r, a, b));
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> m >> n >> q;
x.resize(m + 2);
st.resize(4 * m + 1);
for (int i = 1; i <= n; i++)
{
ll a, b;
cin >> a >> b;
x[a]++;
x[b + 1]--;
}
for (int i = 1; i <= m; ++i)
{
x[i] += x[i - 1];
}
epit(1, 1, n);
for (int i = 1; i <= q; ++i)
{
ll a, b;
cin >> a >> b;
cout<<leker(1, 1, n, a, b)<<"\n";
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1892 KiB | ||||
2 | Accepted | 3ms | 2120 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 3ms | 2312 KiB | ||||
4 | Accepted | 3ms | 2520 KiB | ||||
5 | Accepted | 3ms | 2864 KiB | ||||
6 | Accepted | 3ms | 3072 KiB | ||||
7 | Accepted | 3ms | 3156 KiB | ||||
8 | Accepted | 3ms | 3368 KiB | ||||
9 | Accepted | 3ms | 3584 KiB | ||||
subtask3 | 0/20 | ||||||
10 | Accepted | 3ms | 2312 KiB | ||||
11 | Accepted | 3ms | 2520 KiB | ||||
12 | Accepted | 3ms | 2864 KiB | ||||
13 | Accepted | 3ms | 3072 KiB | ||||
14 | Accepted | 3ms | 3156 KiB | ||||
15 | Accepted | 3ms | 3368 KiB | ||||
16 | Accepted | 3ms | 3584 KiB | ||||
17 | Wrong answer | 6ms | 3912 KiB | ||||
18 | Wrong answer | 6ms | 4236 KiB | ||||
19 | Wrong answer | 6ms | 4320 KiB | ||||
20 | Wrong answer | 6ms | 4548 KiB | ||||
21 | Wrong answer | 6ms | 4876 KiB | ||||
22 | Wrong answer | 4ms | 4936 KiB | ||||
23 | Wrong answer | 6ms | 4884 KiB | ||||
subtask4 | 0/60 | ||||||
24 | Accepted | 3ms | 2312 KiB | ||||
25 | Accepted | 3ms | 2520 KiB | ||||
26 | Accepted | 3ms | 2864 KiB | ||||
27 | Accepted | 3ms | 3072 KiB | ||||
28 | Accepted | 3ms | 3156 KiB | ||||
29 | Accepted | 3ms | 3368 KiB | ||||
30 | Accepted | 3ms | 3584 KiB | ||||
31 | Wrong answer | 6ms | 3912 KiB | ||||
32 | Wrong answer | 6ms | 4236 KiB | ||||
33 | Wrong answer | 6ms | 4320 KiB | ||||
34 | Wrong answer | 6ms | 4548 KiB | ||||
35 | Wrong answer | 6ms | 4876 KiB | ||||
36 | Wrong answer | 4ms | 4936 KiB | ||||
37 | Wrong answer | 6ms | 4884 KiB | ||||
38 | Runtime error | 56ms | 16684 KiB | ||||
39 | Runtime error | 52ms | 16628 KiB | ||||
40 | Runtime error | 54ms | 16628 KiB | ||||
41 | Runtime error | 56ms | 16644 KiB | ||||
42 | Runtime error | 54ms | 16880 KiB | ||||
43 | Runtime error | 54ms | 17100 KiB | ||||
44 | Runtime error | 52ms | 17052 KiB |