#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
ll n,m,k,l,q;
void test() {
cout<<"test"<<endl;
}
int main() {
cin>>n>>q;
vector<pll> students;
vector<pair<pll,ll> > queries;
students.resize(n);
queries.resize(q);
for(int i=0; i<n; i++) {
cin>>students[i].st>>students[i].nd;
}
for(int i=0; i<q; i++) {
cin>>queries[i].st.st>>queries[i].st.nd>>queries[i].nd;
}
for(int i=0; i<q; i++) {
ll s = 0;
for(int j=0; j<n; j++) {
if(students[j].st >= queries[i].st.st and (students[j].nd >= queries[i].st.nd) and students[j].st + students[j].nd >= queries[i].nd) s++;
}
cout<<s<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
504 KB |
Output is correct |
7 |
Correct |
69 ms |
760 KB |
Output is correct |
8 |
Correct |
68 ms |
632 KB |
Output is correct |
9 |
Correct |
69 ms |
632 KB |
Output is correct |
10 |
Correct |
66 ms |
504 KB |
Output is correct |
11 |
Correct |
67 ms |
504 KB |
Output is correct |
12 |
Correct |
65 ms |
552 KB |
Output is correct |
13 |
Correct |
67 ms |
632 KB |
Output is correct |
14 |
Correct |
67 ms |
696 KB |
Output is correct |
15 |
Correct |
68 ms |
504 KB |
Output is correct |
16 |
Correct |
40 ms |
504 KB |
Output is correct |
17 |
Correct |
56 ms |
504 KB |
Output is correct |
18 |
Correct |
23 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3013 ms |
4796 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3013 ms |
4796 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
504 KB |
Output is correct |
7 |
Correct |
69 ms |
760 KB |
Output is correct |
8 |
Correct |
68 ms |
632 KB |
Output is correct |
9 |
Correct |
69 ms |
632 KB |
Output is correct |
10 |
Correct |
66 ms |
504 KB |
Output is correct |
11 |
Correct |
67 ms |
504 KB |
Output is correct |
12 |
Correct |
65 ms |
552 KB |
Output is correct |
13 |
Correct |
67 ms |
632 KB |
Output is correct |
14 |
Correct |
67 ms |
696 KB |
Output is correct |
15 |
Correct |
68 ms |
504 KB |
Output is correct |
16 |
Correct |
40 ms |
504 KB |
Output is correct |
17 |
Correct |
56 ms |
504 KB |
Output is correct |
18 |
Correct |
23 ms |
504 KB |
Output is correct |
19 |
Execution timed out |
3013 ms |
4796 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |