#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;z
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define int long long
//#define ordst tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag , tree_order_statistics_node_update >
//#define double long double
template <class F, class _S>
bool chmin(F &u, const _S &v){
bool flag = false;
if ( u > v ){
u = v; flag |= true;
}
return flag;
}
template <class F, class _S>
bool chmax(F &u, const _S &v){
bool flag = false;
if ( u < v ){
u = v; flag |= true;
}
return flag;
}
const int N = (1<<18) +1, inf = 1e18+200;
//int mod = 998244353;
//int mod = 1000000007;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rnd(l, r) uniform_int_distribution <int> (l, r)(rng)
void solve(){
int n, q;
cin >> n >> q;
vector<array<int, 2>> v(n);
vector<int>ans;
for(auto&[i, j]:v)cin >> i >> j;
for(int i = 0; i < q; i++){
int a, b, c;
cin >> a >> b >> c;
int val = 0;
for(auto [i, j]:v){
if(i+j >= c && i >= a && j >= b)val++;
}
ans.pb(val);
}
for(auto i:ans)cout << i << '\n';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt = 1;
//cin >> tt;
while(tt--){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
380 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
34 ms |
672 KB |
Output is correct |
8 |
Correct |
35 ms |
600 KB |
Output is correct |
9 |
Correct |
34 ms |
676 KB |
Output is correct |
10 |
Correct |
40 ms |
604 KB |
Output is correct |
11 |
Correct |
39 ms |
600 KB |
Output is correct |
12 |
Correct |
34 ms |
344 KB |
Output is correct |
13 |
Correct |
35 ms |
604 KB |
Output is correct |
14 |
Correct |
33 ms |
604 KB |
Output is correct |
15 |
Correct |
33 ms |
604 KB |
Output is correct |
16 |
Correct |
19 ms |
604 KB |
Output is correct |
17 |
Correct |
33 ms |
632 KB |
Output is correct |
18 |
Correct |
15 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3060 ms |
3420 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3060 ms |
3420 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
380 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
34 ms |
672 KB |
Output is correct |
8 |
Correct |
35 ms |
600 KB |
Output is correct |
9 |
Correct |
34 ms |
676 KB |
Output is correct |
10 |
Correct |
40 ms |
604 KB |
Output is correct |
11 |
Correct |
39 ms |
600 KB |
Output is correct |
12 |
Correct |
34 ms |
344 KB |
Output is correct |
13 |
Correct |
35 ms |
604 KB |
Output is correct |
14 |
Correct |
33 ms |
604 KB |
Output is correct |
15 |
Correct |
33 ms |
604 KB |
Output is correct |
16 |
Correct |
19 ms |
604 KB |
Output is correct |
17 |
Correct |
33 ms |
632 KB |
Output is correct |
18 |
Correct |
15 ms |
604 KB |
Output is correct |
19 |
Execution timed out |
3060 ms |
3420 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |