#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;
vi s(n),t(n);
FOR(i,n){
cin >> s[i] >> t[i];
}
vi 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;
}
}
int 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 |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
50 ms |
632 KB |
Output is correct |
8 |
Correct |
49 ms |
512 KB |
Output is correct |
9 |
Correct |
49 ms |
632 KB |
Output is correct |
10 |
Correct |
57 ms |
512 KB |
Output is correct |
11 |
Correct |
56 ms |
544 KB |
Output is correct |
12 |
Correct |
50 ms |
384 KB |
Output is correct |
13 |
Correct |
51 ms |
512 KB |
Output is correct |
14 |
Correct |
52 ms |
512 KB |
Output is correct |
15 |
Correct |
52 ms |
512 KB |
Output is correct |
16 |
Correct |
25 ms |
512 KB |
Output is correct |
17 |
Correct |
53 ms |
512 KB |
Output is correct |
18 |
Correct |
11 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3025 ms |
5068 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3025 ms |
5068 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
50 ms |
632 KB |
Output is correct |
8 |
Correct |
49 ms |
512 KB |
Output is correct |
9 |
Correct |
49 ms |
632 KB |
Output is correct |
10 |
Correct |
57 ms |
512 KB |
Output is correct |
11 |
Correct |
56 ms |
544 KB |
Output is correct |
12 |
Correct |
50 ms |
384 KB |
Output is correct |
13 |
Correct |
51 ms |
512 KB |
Output is correct |
14 |
Correct |
52 ms |
512 KB |
Output is correct |
15 |
Correct |
52 ms |
512 KB |
Output is correct |
16 |
Correct |
25 ms |
512 KB |
Output is correct |
17 |
Correct |
53 ms |
512 KB |
Output is correct |
18 |
Correct |
11 ms |
384 KB |
Output is correct |
19 |
Execution timed out |
3025 ms |
5068 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |