#include <bits/stdc++.h>
typedef long long 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;
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());
vector<ll> stuff;
ll cur = 100004;
for (auto&i : queries){
while (cur >= i[0]){
for (auto&i : students[cur]) stuff.push_back(i);
cur--;
}
sort(stuff.begin(), stuff.end());
reverse(stuff.begin(), stuff.end());
ll temp = upper_bound(stuff.begin(), stuff.end(), i[1]) - stuff.begin() - 1;
ans[i[3]] = temp;
}
for (auto&i : ans) cout << i << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3073 ms |
15476 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3073 ms |
15476 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |