#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define OPT ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) \
cout << v[i] << " "; \
cout<<endl;
struct DSU {
vector<int> e;
void init(int n)
{
e.assign(n, -1);
}
int get(int x)
{
if (e[x] < 0)
return x;
return get(e[x]);
}
bool together(int a, int b)
{
if (get(a) == get(b))
return true;
return false;
}
int s(int x)
{
return -e[get(x)];
}
bool un(int x, int y)
{
x = get(x);
y = get(y);
if (x == y) return false;
if (e[x] > e[y]) swap(x, y);
e[x] += e[y];
e[y] = x;
return true;
}
};
int n;
int main()
{
int q;
cin >> n >> q;
vector<pii> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i].fi >> v[i].se;
}
while (q--)
{
int a, b, c;
cin >> a >> b >> c;
int cnt = 0;
for (int i = 0; i < n; i++)
{
if (v[i].fi >= a && v[i].se >= b && v[i].fi + v[i].se >= c)
{
cnt++;
}
}
cout << cnt << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
220 KB |
Output is correct |
7 |
Correct |
46 ms |
324 KB |
Output is correct |
8 |
Correct |
46 ms |
212 KB |
Output is correct |
9 |
Correct |
48 ms |
212 KB |
Output is correct |
10 |
Correct |
44 ms |
328 KB |
Output is correct |
11 |
Correct |
49 ms |
328 KB |
Output is correct |
12 |
Correct |
52 ms |
328 KB |
Output is correct |
13 |
Correct |
53 ms |
312 KB |
Output is correct |
14 |
Correct |
47 ms |
320 KB |
Output is correct |
15 |
Correct |
46 ms |
328 KB |
Output is correct |
16 |
Correct |
32 ms |
324 KB |
Output is correct |
17 |
Correct |
36 ms |
328 KB |
Output is correct |
18 |
Correct |
14 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3057 ms |
1232 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3057 ms |
1232 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
220 KB |
Output is correct |
7 |
Correct |
46 ms |
324 KB |
Output is correct |
8 |
Correct |
46 ms |
212 KB |
Output is correct |
9 |
Correct |
48 ms |
212 KB |
Output is correct |
10 |
Correct |
44 ms |
328 KB |
Output is correct |
11 |
Correct |
49 ms |
328 KB |
Output is correct |
12 |
Correct |
52 ms |
328 KB |
Output is correct |
13 |
Correct |
53 ms |
312 KB |
Output is correct |
14 |
Correct |
47 ms |
320 KB |
Output is correct |
15 |
Correct |
46 ms |
328 KB |
Output is correct |
16 |
Correct |
32 ms |
324 KB |
Output is correct |
17 |
Correct |
36 ms |
328 KB |
Output is correct |
18 |
Correct |
14 ms |
212 KB |
Output is correct |
19 |
Execution timed out |
3057 ms |
1232 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |