#include <bits/stdc++.h>
using i64 = long long;
struct Vector {
i64 x, y;
Vector(i64 x = 0, i64 y = 0) : x(x), y(y) {}
Vector operator-(Vector b) {
return Vector(x - b.x, y - b.y);
}
Vector operator+(Vector b) {
return Vector(x + b.x, y + b.y);
}
i64 length() {
return x * x + y * y;
}
};
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
i64 R;
std::cin >> n >> R;
std::vector<Vector> a(n), b(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i].x >> a[i].y >> b[i].x >> b[i].y;
}
std::vector<std::pair<int, int>> v;
for (int i = 0; i < n; i++) {
int l = -1, r = -1;
Vector cur = a[i];
Vector delta = b[i] - a[i];
for (int j = 0; j < 20005; j++) {
if (cur.length() <= R * R) {
if (l == -1) {
l = j;
}
r = j;
}
cur = cur + delta;
}
if (l != -1) {
v.push_back({l, r});
}
}
std::vector<int> cnt(20005);
for (auto [l, r] : v) {
for (int i = l; i <= r; i++) {
cnt[i]++;
}
}
std::cout << *max_element(cnt.begin(), cnt.end()) << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
19 ms |
340 KB |
Output is correct |
4 |
Correct |
17 ms |
372 KB |
Output is correct |
5 |
Correct |
19 ms |
340 KB |
Output is correct |
6 |
Correct |
18 ms |
372 KB |
Output is correct |
7 |
Correct |
24 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
316 KB |
Output is correct |
12 |
Correct |
1 ms |
324 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
24 ms |
384 KB |
Output is correct |
15 |
Correct |
24 ms |
376 KB |
Output is correct |
16 |
Correct |
22 ms |
376 KB |
Output is correct |
17 |
Correct |
22 ms |
480 KB |
Output is correct |
18 |
Correct |
23 ms |
376 KB |
Output is correct |
19 |
Correct |
19 ms |
368 KB |
Output is correct |
20 |
Correct |
22 ms |
368 KB |
Output is correct |
21 |
Correct |
18 ms |
460 KB |
Output is correct |
22 |
Correct |
19 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
19 ms |
340 KB |
Output is correct |
4 |
Correct |
17 ms |
372 KB |
Output is correct |
5 |
Correct |
19 ms |
340 KB |
Output is correct |
6 |
Correct |
18 ms |
372 KB |
Output is correct |
7 |
Correct |
24 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
316 KB |
Output is correct |
12 |
Correct |
1 ms |
324 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
24 ms |
384 KB |
Output is correct |
15 |
Correct |
24 ms |
376 KB |
Output is correct |
16 |
Correct |
22 ms |
376 KB |
Output is correct |
17 |
Correct |
22 ms |
480 KB |
Output is correct |
18 |
Correct |
23 ms |
376 KB |
Output is correct |
19 |
Correct |
19 ms |
368 KB |
Output is correct |
20 |
Correct |
22 ms |
368 KB |
Output is correct |
21 |
Correct |
18 ms |
460 KB |
Output is correct |
22 |
Correct |
19 ms |
340 KB |
Output is correct |
23 |
Execution timed out |
1062 ms |
5696 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
19 ms |
340 KB |
Output is correct |
4 |
Correct |
17 ms |
372 KB |
Output is correct |
5 |
Correct |
19 ms |
340 KB |
Output is correct |
6 |
Correct |
18 ms |
372 KB |
Output is correct |
7 |
Correct |
24 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
316 KB |
Output is correct |
12 |
Correct |
1 ms |
324 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
24 ms |
384 KB |
Output is correct |
15 |
Correct |
24 ms |
376 KB |
Output is correct |
16 |
Correct |
22 ms |
376 KB |
Output is correct |
17 |
Correct |
22 ms |
480 KB |
Output is correct |
18 |
Correct |
23 ms |
376 KB |
Output is correct |
19 |
Correct |
19 ms |
368 KB |
Output is correct |
20 |
Correct |
22 ms |
368 KB |
Output is correct |
21 |
Correct |
18 ms |
460 KB |
Output is correct |
22 |
Correct |
19 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
23 ms |
376 KB |
Output is correct |
25 |
Correct |
25 ms |
372 KB |
Output is correct |
26 |
Correct |
17 ms |
372 KB |
Output is correct |
27 |
Correct |
19 ms |
380 KB |
Output is correct |
28 |
Correct |
19 ms |
464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
19 ms |
340 KB |
Output is correct |
4 |
Correct |
17 ms |
372 KB |
Output is correct |
5 |
Correct |
19 ms |
340 KB |
Output is correct |
6 |
Correct |
18 ms |
372 KB |
Output is correct |
7 |
Correct |
24 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
316 KB |
Output is correct |
12 |
Correct |
1 ms |
324 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
24 ms |
384 KB |
Output is correct |
15 |
Correct |
24 ms |
376 KB |
Output is correct |
16 |
Correct |
22 ms |
376 KB |
Output is correct |
17 |
Correct |
22 ms |
480 KB |
Output is correct |
18 |
Correct |
23 ms |
376 KB |
Output is correct |
19 |
Correct |
19 ms |
368 KB |
Output is correct |
20 |
Correct |
22 ms |
368 KB |
Output is correct |
21 |
Correct |
18 ms |
460 KB |
Output is correct |
22 |
Correct |
19 ms |
340 KB |
Output is correct |
23 |
Execution timed out |
1062 ms |
5696 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
19 ms |
340 KB |
Output is correct |
4 |
Correct |
17 ms |
372 KB |
Output is correct |
5 |
Correct |
19 ms |
340 KB |
Output is correct |
6 |
Correct |
18 ms |
372 KB |
Output is correct |
7 |
Correct |
24 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
316 KB |
Output is correct |
12 |
Correct |
1 ms |
324 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
24 ms |
384 KB |
Output is correct |
15 |
Correct |
24 ms |
376 KB |
Output is correct |
16 |
Correct |
22 ms |
376 KB |
Output is correct |
17 |
Correct |
22 ms |
480 KB |
Output is correct |
18 |
Correct |
23 ms |
376 KB |
Output is correct |
19 |
Correct |
19 ms |
368 KB |
Output is correct |
20 |
Correct |
22 ms |
368 KB |
Output is correct |
21 |
Correct |
18 ms |
460 KB |
Output is correct |
22 |
Correct |
19 ms |
340 KB |
Output is correct |
23 |
Execution timed out |
1062 ms |
5696 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |