#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define ent "\n"
const int inf = (int)1e9 + 100;
const int maxn = 5e5 + 100;
const ll INF = (ll)1e18;
const int MOD = 1e9 + 7;
const int maxl = 62500;
const ll P = 31, T = 0;
int n, r;
int a[maxn];
int b[maxn];
int c[maxn];
int d[maxn];
bool ok(int x, int y){
return x * x + y * y <= r * r;
}
void test(){
cin >> n >> r;
vector<pii> v;
for(int i = 1; i <= n; i++){
cin >> a[i] >> b[i];
cin >> c[i] >> d[i];
c[i] -= a[i], d[i] -= b[i];
int l = inf, r;
for(int j = 0; abs(a[i]) <= 10000 && abs(b[i]) <= 10000; j++, a[i] += c[i], b[i] += d[i]){
if(ok(a[i], b[i])){
if(l == inf){
l = j;
}
r = j;
}
}
if(l != inf){
v.push_back({l, 1});
v.push_back({r+1, -1});
}
}
int ans = 0, cnt = 0;
sort(v.begin(), v.end());
for(int i = 0; i < v.size();){
int j = i;
while(j < v.size() && v[j].first == v[i].first){
cnt += v[j].second; j++;
}
ans = max(ans, cnt);
i = j;
}
cout << ans;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int t = 1;
if(T) cin >> t;
while(t--) test();
}
Compilation message
noras.cpp: In function 'void test()':
noras.cpp:48:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
48 | for(int i = 0; i < v.size();){
| ~~^~~~~~~~~~
noras.cpp:50:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | while(j < v.size() && v[j].first == v[i].first){
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
3 ms |
6492 KB |
Output is correct |
5 |
Correct |
2 ms |
6492 KB |
Output is correct |
6 |
Correct |
2 ms |
6492 KB |
Output is correct |
7 |
Correct |
2 ms |
6492 KB |
Output is correct |
8 |
Correct |
2 ms |
6616 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
2 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
6492 KB |
Output is correct |
13 |
Correct |
1 ms |
6492 KB |
Output is correct |
14 |
Correct |
27 ms |
6492 KB |
Output is correct |
15 |
Correct |
26 ms |
6492 KB |
Output is correct |
16 |
Correct |
27 ms |
6492 KB |
Output is correct |
17 |
Correct |
26 ms |
6680 KB |
Output is correct |
18 |
Correct |
27 ms |
6492 KB |
Output is correct |
19 |
Correct |
10 ms |
6492 KB |
Output is correct |
20 |
Correct |
10 ms |
6492 KB |
Output is correct |
21 |
Correct |
11 ms |
6660 KB |
Output is correct |
22 |
Correct |
10 ms |
6632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
3 ms |
6492 KB |
Output is correct |
5 |
Correct |
2 ms |
6492 KB |
Output is correct |
6 |
Correct |
2 ms |
6492 KB |
Output is correct |
7 |
Correct |
2 ms |
6492 KB |
Output is correct |
8 |
Correct |
2 ms |
6616 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
2 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
6492 KB |
Output is correct |
13 |
Correct |
1 ms |
6492 KB |
Output is correct |
14 |
Correct |
27 ms |
6492 KB |
Output is correct |
15 |
Correct |
26 ms |
6492 KB |
Output is correct |
16 |
Correct |
27 ms |
6492 KB |
Output is correct |
17 |
Correct |
26 ms |
6680 KB |
Output is correct |
18 |
Correct |
27 ms |
6492 KB |
Output is correct |
19 |
Correct |
10 ms |
6492 KB |
Output is correct |
20 |
Correct |
10 ms |
6492 KB |
Output is correct |
21 |
Correct |
11 ms |
6660 KB |
Output is correct |
22 |
Correct |
10 ms |
6632 KB |
Output is correct |
23 |
Correct |
31 ms |
10188 KB |
Output is correct |
24 |
Correct |
30 ms |
10200 KB |
Output is correct |
25 |
Correct |
33 ms |
10200 KB |
Output is correct |
26 |
Correct |
30 ms |
10200 KB |
Output is correct |
27 |
Correct |
641 ms |
9720 KB |
Output is correct |
28 |
Correct |
658 ms |
10368 KB |
Output is correct |
29 |
Correct |
666 ms |
10188 KB |
Output is correct |
30 |
Correct |
651 ms |
10336 KB |
Output is correct |
31 |
Correct |
659 ms |
10368 KB |
Output is correct |
32 |
Execution timed out |
1061 ms |
8660 KB |
Time limit exceeded |
33 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
3 ms |
6492 KB |
Output is correct |
5 |
Correct |
2 ms |
6492 KB |
Output is correct |
6 |
Correct |
2 ms |
6492 KB |
Output is correct |
7 |
Correct |
2 ms |
6492 KB |
Output is correct |
8 |
Correct |
2 ms |
6616 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
2 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
6492 KB |
Output is correct |
13 |
Correct |
1 ms |
6492 KB |
Output is correct |
14 |
Correct |
27 ms |
6492 KB |
Output is correct |
15 |
Correct |
26 ms |
6492 KB |
Output is correct |
16 |
Correct |
27 ms |
6492 KB |
Output is correct |
17 |
Correct |
26 ms |
6680 KB |
Output is correct |
18 |
Correct |
27 ms |
6492 KB |
Output is correct |
19 |
Correct |
10 ms |
6492 KB |
Output is correct |
20 |
Correct |
10 ms |
6492 KB |
Output is correct |
21 |
Correct |
11 ms |
6660 KB |
Output is correct |
22 |
Correct |
10 ms |
6632 KB |
Output is correct |
23 |
Correct |
2 ms |
6492 KB |
Output is correct |
24 |
Correct |
2 ms |
6492 KB |
Output is correct |
25 |
Correct |
28 ms |
6648 KB |
Output is correct |
26 |
Correct |
10 ms |
6492 KB |
Output is correct |
27 |
Correct |
11 ms |
6492 KB |
Output is correct |
28 |
Correct |
13 ms |
6492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
3 ms |
6492 KB |
Output is correct |
5 |
Correct |
2 ms |
6492 KB |
Output is correct |
6 |
Correct |
2 ms |
6492 KB |
Output is correct |
7 |
Correct |
2 ms |
6492 KB |
Output is correct |
8 |
Correct |
2 ms |
6616 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
2 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
6492 KB |
Output is correct |
13 |
Correct |
1 ms |
6492 KB |
Output is correct |
14 |
Correct |
27 ms |
6492 KB |
Output is correct |
15 |
Correct |
26 ms |
6492 KB |
Output is correct |
16 |
Correct |
27 ms |
6492 KB |
Output is correct |
17 |
Correct |
26 ms |
6680 KB |
Output is correct |
18 |
Correct |
27 ms |
6492 KB |
Output is correct |
19 |
Correct |
10 ms |
6492 KB |
Output is correct |
20 |
Correct |
10 ms |
6492 KB |
Output is correct |
21 |
Correct |
11 ms |
6660 KB |
Output is correct |
22 |
Correct |
10 ms |
6632 KB |
Output is correct |
23 |
Correct |
31 ms |
10188 KB |
Output is correct |
24 |
Correct |
30 ms |
10200 KB |
Output is correct |
25 |
Correct |
33 ms |
10200 KB |
Output is correct |
26 |
Correct |
30 ms |
10200 KB |
Output is correct |
27 |
Correct |
641 ms |
9720 KB |
Output is correct |
28 |
Correct |
658 ms |
10368 KB |
Output is correct |
29 |
Correct |
666 ms |
10188 KB |
Output is correct |
30 |
Correct |
651 ms |
10336 KB |
Output is correct |
31 |
Correct |
659 ms |
10368 KB |
Output is correct |
32 |
Execution timed out |
1061 ms |
8660 KB |
Time limit exceeded |
33 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
3 ms |
6492 KB |
Output is correct |
5 |
Correct |
2 ms |
6492 KB |
Output is correct |
6 |
Correct |
2 ms |
6492 KB |
Output is correct |
7 |
Correct |
2 ms |
6492 KB |
Output is correct |
8 |
Correct |
2 ms |
6616 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
2 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
6492 KB |
Output is correct |
13 |
Correct |
1 ms |
6492 KB |
Output is correct |
14 |
Correct |
27 ms |
6492 KB |
Output is correct |
15 |
Correct |
26 ms |
6492 KB |
Output is correct |
16 |
Correct |
27 ms |
6492 KB |
Output is correct |
17 |
Correct |
26 ms |
6680 KB |
Output is correct |
18 |
Correct |
27 ms |
6492 KB |
Output is correct |
19 |
Correct |
10 ms |
6492 KB |
Output is correct |
20 |
Correct |
10 ms |
6492 KB |
Output is correct |
21 |
Correct |
11 ms |
6660 KB |
Output is correct |
22 |
Correct |
10 ms |
6632 KB |
Output is correct |
23 |
Correct |
31 ms |
10188 KB |
Output is correct |
24 |
Correct |
30 ms |
10200 KB |
Output is correct |
25 |
Correct |
33 ms |
10200 KB |
Output is correct |
26 |
Correct |
30 ms |
10200 KB |
Output is correct |
27 |
Correct |
641 ms |
9720 KB |
Output is correct |
28 |
Correct |
658 ms |
10368 KB |
Output is correct |
29 |
Correct |
666 ms |
10188 KB |
Output is correct |
30 |
Correct |
651 ms |
10336 KB |
Output is correct |
31 |
Correct |
659 ms |
10368 KB |
Output is correct |
32 |
Execution timed out |
1061 ms |
8660 KB |
Time limit exceeded |
33 |
Halted |
0 ms |
0 KB |
- |