#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
#define int long long int
#define ld long double
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define ppii pair<ii,int>
#define pll pair<ll,ll>
#define vv vector
#define endl '\n'
using namespace std;
void solve(){
int n , q; cin >> n >> q;
int s[n],t[n];
FOR(i,n){
cin >> s[i] >> t[i];
}
int x[q],y[q],z[q];
FOR (i,q) {
cin >> x[i] >> y[i] >> z[i];
}
// int j = 0;
// int a= 0,b= 0,c= 0;
FOR(j,q){
int ans = 0;
FOR(i,n){
if(s[i]+t[i] >= z[j] && s[i] >= x[j] && t[i] >= y[j]) {
ans++;
}
}
cout << ans << endl;
}
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin >> t;
while (t--){
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
50 ms |
504 KB |
Output is correct |
8 |
Correct |
51 ms |
504 KB |
Output is correct |
9 |
Correct |
50 ms |
512 KB |
Output is correct |
10 |
Correct |
59 ms |
504 KB |
Output is correct |
11 |
Correct |
58 ms |
632 KB |
Output is correct |
12 |
Correct |
51 ms |
504 KB |
Output is correct |
13 |
Correct |
52 ms |
504 KB |
Output is correct |
14 |
Correct |
55 ms |
508 KB |
Output is correct |
15 |
Correct |
56 ms |
504 KB |
Output is correct |
16 |
Correct |
28 ms |
512 KB |
Output is correct |
17 |
Correct |
48 ms |
504 KB |
Output is correct |
18 |
Correct |
16 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3073 ms |
4344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3073 ms |
4344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
50 ms |
504 KB |
Output is correct |
8 |
Correct |
51 ms |
504 KB |
Output is correct |
9 |
Correct |
50 ms |
512 KB |
Output is correct |
10 |
Correct |
59 ms |
504 KB |
Output is correct |
11 |
Correct |
58 ms |
632 KB |
Output is correct |
12 |
Correct |
51 ms |
504 KB |
Output is correct |
13 |
Correct |
52 ms |
504 KB |
Output is correct |
14 |
Correct |
55 ms |
508 KB |
Output is correct |
15 |
Correct |
56 ms |
504 KB |
Output is correct |
16 |
Correct |
28 ms |
512 KB |
Output is correct |
17 |
Correct |
48 ms |
504 KB |
Output is correct |
18 |
Correct |
16 ms |
512 KB |
Output is correct |
19 |
Execution timed out |
3073 ms |
4344 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |