#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef int ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(lli = x; i>y; i--)
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
vector<ll> students[100005];
int main(){
ll n,q;
cin >> n >> q;
vector<vector<ll>> st;
FOR(i,0,n){
ll a,b;
cin >> a >> b;
students[a].push_back(b);
}
vector<vector<ll>> queries;
FOR(i,0,q){
ll x,y,z;
cin >> x >> y >> z;
queries.push_back({x,y,z, i});
}
vector<ll> ans(q);
sort(queries.begin(), queries.end());
reverse(queries.begin(), queries.end());
ordered_set stuff;
ll cur = 100004;
for (auto&i : queries){
while (cur >= i[0]){
for (auto&i : students[cur]) stuff.insert(i);
cur--;
}
// cout << i[1] << endl;
// for (auto&i : stuff) cout << i << " ";
// cout << endl;
// cout << stuff.order_of_key(i[1]) << endl;
ans[i[3]] = stuff.size() - stuff.order_of_key(i[1]);
}
for (auto&i : ans) cout << i << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
164 ms |
15832 KB |
Output is correct |
2 |
Correct |
163 ms |
18172 KB |
Output is correct |
3 |
Correct |
158 ms |
18212 KB |
Output is correct |
4 |
Correct |
131 ms |
17656 KB |
Output is correct |
5 |
Correct |
130 ms |
16124 KB |
Output is correct |
6 |
Correct |
107 ms |
15356 KB |
Output is correct |
7 |
Correct |
165 ms |
18312 KB |
Output is correct |
8 |
Correct |
162 ms |
18112 KB |
Output is correct |
9 |
Correct |
149 ms |
18172 KB |
Output is correct |
10 |
Correct |
124 ms |
15716 KB |
Output is correct |
11 |
Correct |
151 ms |
17364 KB |
Output is correct |
12 |
Correct |
108 ms |
14900 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
164 ms |
15832 KB |
Output is correct |
2 |
Correct |
163 ms |
18172 KB |
Output is correct |
3 |
Correct |
158 ms |
18212 KB |
Output is correct |
4 |
Correct |
131 ms |
17656 KB |
Output is correct |
5 |
Correct |
130 ms |
16124 KB |
Output is correct |
6 |
Correct |
107 ms |
15356 KB |
Output is correct |
7 |
Correct |
165 ms |
18312 KB |
Output is correct |
8 |
Correct |
162 ms |
18112 KB |
Output is correct |
9 |
Correct |
149 ms |
18172 KB |
Output is correct |
10 |
Correct |
124 ms |
15716 KB |
Output is correct |
11 |
Correct |
151 ms |
17364 KB |
Output is correct |
12 |
Correct |
108 ms |
14900 KB |
Output is correct |
13 |
Incorrect |
166 ms |
18684 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |