/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define ui unsigned int
#define f first
#define s second
#define ins insert
#define pb push_back
#define mp make_pair
#define ln '\n'
#define int ll
#define pii pair<int , int>
#define INF LLONG_MAX
#define vv(a) vector<a>
#define pp(a, b) pair<a, b>
#define pq(a) priority_queue<a>
#define qq(a) queue<a>
#define ss(a) set<a>
#define mss(a) multiset<a>
#define mm(a, b) map<a, b>
#define mmm(a , b) multimap<a , b>
#define sz(x) (x).size()
#define all(x) (x).begin() , (x).end()
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void solve(){
int n , q;
cin >> n >> q;
vv(pii) a(n);
for(int i=0 ; i<n ; i++){
cin >> a[i].f >> a[i].s;
}
if(n <= 3000 && q <= 3000){
for(int i=0 ; i<q ; i++){
int x , y , z , ans = 0;
cin >> x >> y >> z;
for(int j=0 ; j<n ; j++){
if(a[j].f >= x && a[j].s >= y && a[j].f + a[j].s >= z){
ans++;
}
}
cout << ans << ln;
}
}
}
signed main(){
fastio
int t = 1;
//cin >> t;
while(t--){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
40 ms |
364 KB |
Output is correct |
8 |
Correct |
40 ms |
376 KB |
Output is correct |
9 |
Correct |
40 ms |
384 KB |
Output is correct |
10 |
Correct |
47 ms |
492 KB |
Output is correct |
11 |
Correct |
43 ms |
368 KB |
Output is correct |
12 |
Correct |
40 ms |
340 KB |
Output is correct |
13 |
Correct |
40 ms |
368 KB |
Output is correct |
14 |
Correct |
40 ms |
340 KB |
Output is correct |
15 |
Correct |
40 ms |
372 KB |
Output is correct |
16 |
Correct |
19 ms |
380 KB |
Output is correct |
17 |
Correct |
29 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
1876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
1876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
40 ms |
364 KB |
Output is correct |
8 |
Correct |
40 ms |
376 KB |
Output is correct |
9 |
Correct |
40 ms |
384 KB |
Output is correct |
10 |
Correct |
47 ms |
492 KB |
Output is correct |
11 |
Correct |
43 ms |
368 KB |
Output is correct |
12 |
Correct |
40 ms |
340 KB |
Output is correct |
13 |
Correct |
40 ms |
368 KB |
Output is correct |
14 |
Correct |
40 ms |
340 KB |
Output is correct |
15 |
Correct |
40 ms |
372 KB |
Output is correct |
16 |
Correct |
19 ms |
380 KB |
Output is correct |
17 |
Correct |
29 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
368 KB |
Output is correct |
19 |
Incorrect |
13 ms |
1876 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |