# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
770964 |
2023-07-02T08:19:05 Z |
dxz05 |
Wish (LMIO19_noras) |
C++17 |
|
611 ms |
9048 KB |
//#pragma GCC optimize("Ofast,O3,unroll-loops")
//#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bpc(x) __builtin_popcount(x)
#define bpcll(x) __builtin_popcountll(x)
#define MP make_pair
//#define endl '\n'
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long long ll;
const int MOD = 1e9 + 7;
const int N = 2005;
#define loop for (int it = 0; it < 200; it++)
#define ld long long
void solve(){
int n; ld R;
cin >> n >> R;
R *= R;
ld lim = 3e4;
vector<ld> st, en;
map<ld, int> mp;
for (int i = 1; i <= n; i++){
ld a, b, c, d;
cin >> a >> b >> c >> d;
auto dist = [&](ld t) -> ld{
ld x = c - a, y = d - b;
x = x * t + a;
y = y * t + b;
return x * x + y * y;
};
ld t = -1, dt = R + 5;
ld l = 0, r = lim;
loop{
ld m1 = l + (r - l) / 3;
ld m2 = r - (r - l) / 3;
ld f1 = dist(m1), f2 = dist(m2);
if (f1 < dt) t = m1, dt = f1;
if (f2 < dt) t = m2, dt = f2;
if (f1 < f2){
r = m2;
} else {
l = m1;
}
}
if (dt > R) continue;
ld _st = t, _en = t;
l = 0, r = t;
loop{
ld m = (l + r) / 2;
if (dist(m) <= R){
_st = min(_st, m);
r = m;
} else {
l = m;
}
}
l = t, r = lim;
loop{
ld m = (l + r) / 2;
if (dist(m) <= R){
_en = max(_en, m);
l = m;
} else {
r = m;
}
}
st.push_back(_st);
en.push_back(_en);
mp[_st] = mp[_en] = 0;
}
int z = 0;
for (auto &now : mp) now.second = ++z;
vector<int> cnt(z + 2, 0);
for (int i = 0; i < (int) st.size(); i++){
cnt[mp[st[i]]]++;
cnt[mp[en[i]] + 1]--;
}
int ans = 0;
for (int i = 1; i <= z + 1; i++){
cnt[i] += cnt[i - 1];
ans = max(ans, cnt[i]);
}
cout << ans << endl;
}
int main(){
clock_t startTime = clock();
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int test_cases = 1;
// cin >> test_cases;
for (int test = 1; test <= test_cases; test++){
//cout << (solve() ? "YES" : "NO") << endl;
solve();
}
#ifdef LOCAL
cerr << "Time: " << int((double) (clock() - startTime) / CLOCKS_PER_SEC * 1000) << " ms" << endl;
#endif
return 0;
}
Compilation message
noras.cpp: In function 'int main()':
noras.cpp:117:13: warning: unused variable 'startTime' [-Wunused-variable]
117 | clock_t startTime = clock();
| ^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
3 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
324 KB |
Output is correct |
14 |
Correct |
3 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
340 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
3 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
368 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
3 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
324 KB |
Output is correct |
14 |
Correct |
3 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
340 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
3 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
368 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
340 KB |
Output is correct |
23 |
Correct |
235 ms |
3600 KB |
Output is correct |
24 |
Correct |
249 ms |
3512 KB |
Output is correct |
25 |
Correct |
231 ms |
3568 KB |
Output is correct |
26 |
Correct |
234 ms |
3844 KB |
Output is correct |
27 |
Correct |
198 ms |
3176 KB |
Output is correct |
28 |
Correct |
244 ms |
3516 KB |
Output is correct |
29 |
Correct |
231 ms |
3772 KB |
Output is correct |
30 |
Correct |
234 ms |
3636 KB |
Output is correct |
31 |
Correct |
232 ms |
3616 KB |
Output is correct |
32 |
Correct |
262 ms |
3688 KB |
Output is correct |
33 |
Correct |
256 ms |
3920 KB |
Output is correct |
34 |
Correct |
258 ms |
3768 KB |
Output is correct |
35 |
Correct |
258 ms |
3788 KB |
Output is correct |
36 |
Correct |
255 ms |
3796 KB |
Output is correct |
37 |
Correct |
212 ms |
3100 KB |
Output is correct |
38 |
Correct |
209 ms |
3060 KB |
Output is correct |
39 |
Correct |
199 ms |
2928 KB |
Output is correct |
40 |
Correct |
212 ms |
2832 KB |
Output is correct |
41 |
Correct |
206 ms |
2848 KB |
Output is correct |
42 |
Correct |
198 ms |
2976 KB |
Output is correct |
43 |
Correct |
597 ms |
9028 KB |
Output is correct |
44 |
Correct |
611 ms |
9048 KB |
Output is correct |
45 |
Correct |
589 ms |
8968 KB |
Output is correct |
46 |
Correct |
595 ms |
9000 KB |
Output is correct |
47 |
Correct |
588 ms |
9012 KB |
Output is correct |
48 |
Correct |
530 ms |
7192 KB |
Output is correct |
49 |
Correct |
513 ms |
6944 KB |
Output is correct |
50 |
Correct |
517 ms |
7000 KB |
Output is correct |
51 |
Correct |
518 ms |
6948 KB |
Output is correct |
52 |
Correct |
513 ms |
6996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
3 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
324 KB |
Output is correct |
14 |
Correct |
3 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
340 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
3 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
368 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
324 KB |
Output is correct |
24 |
Correct |
3 ms |
336 KB |
Output is correct |
25 |
Correct |
3 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
3 ms |
348 KB |
Output is correct |
28 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
3 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
324 KB |
Output is correct |
14 |
Correct |
3 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
340 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
3 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
368 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
340 KB |
Output is correct |
23 |
Correct |
235 ms |
3600 KB |
Output is correct |
24 |
Correct |
249 ms |
3512 KB |
Output is correct |
25 |
Correct |
231 ms |
3568 KB |
Output is correct |
26 |
Correct |
234 ms |
3844 KB |
Output is correct |
27 |
Correct |
198 ms |
3176 KB |
Output is correct |
28 |
Correct |
244 ms |
3516 KB |
Output is correct |
29 |
Correct |
231 ms |
3772 KB |
Output is correct |
30 |
Correct |
234 ms |
3636 KB |
Output is correct |
31 |
Correct |
232 ms |
3616 KB |
Output is correct |
32 |
Correct |
262 ms |
3688 KB |
Output is correct |
33 |
Correct |
256 ms |
3920 KB |
Output is correct |
34 |
Correct |
258 ms |
3768 KB |
Output is correct |
35 |
Correct |
258 ms |
3788 KB |
Output is correct |
36 |
Correct |
255 ms |
3796 KB |
Output is correct |
37 |
Correct |
212 ms |
3100 KB |
Output is correct |
38 |
Correct |
209 ms |
3060 KB |
Output is correct |
39 |
Correct |
199 ms |
2928 KB |
Output is correct |
40 |
Correct |
212 ms |
2832 KB |
Output is correct |
41 |
Correct |
206 ms |
2848 KB |
Output is correct |
42 |
Correct |
198 ms |
2976 KB |
Output is correct |
43 |
Correct |
597 ms |
9028 KB |
Output is correct |
44 |
Correct |
611 ms |
9048 KB |
Output is correct |
45 |
Correct |
589 ms |
8968 KB |
Output is correct |
46 |
Correct |
595 ms |
9000 KB |
Output is correct |
47 |
Correct |
588 ms |
9012 KB |
Output is correct |
48 |
Correct |
530 ms |
7192 KB |
Output is correct |
49 |
Correct |
513 ms |
6944 KB |
Output is correct |
50 |
Correct |
517 ms |
7000 KB |
Output is correct |
51 |
Correct |
518 ms |
6948 KB |
Output is correct |
52 |
Correct |
513 ms |
6996 KB |
Output is correct |
53 |
Correct |
0 ms |
324 KB |
Output is correct |
54 |
Correct |
3 ms |
336 KB |
Output is correct |
55 |
Correct |
3 ms |
340 KB |
Output is correct |
56 |
Correct |
2 ms |
340 KB |
Output is correct |
57 |
Correct |
3 ms |
348 KB |
Output is correct |
58 |
Correct |
3 ms |
340 KB |
Output is correct |
59 |
Correct |
232 ms |
3532 KB |
Output is correct |
60 |
Correct |
198 ms |
3284 KB |
Output is correct |
61 |
Correct |
222 ms |
3232 KB |
Output is correct |
62 |
Correct |
207 ms |
3312 KB |
Output is correct |
63 |
Correct |
215 ms |
3616 KB |
Output is correct |
64 |
Correct |
218 ms |
3624 KB |
Output is correct |
65 |
Correct |
217 ms |
3632 KB |
Output is correct |
66 |
Correct |
221 ms |
3636 KB |
Output is correct |
67 |
Correct |
224 ms |
3708 KB |
Output is correct |
68 |
Correct |
264 ms |
3932 KB |
Output is correct |
69 |
Correct |
272 ms |
3904 KB |
Output is correct |
70 |
Correct |
273 ms |
3964 KB |
Output is correct |
71 |
Correct |
261 ms |
3832 KB |
Output is correct |
72 |
Correct |
267 ms |
3860 KB |
Output is correct |
73 |
Correct |
205 ms |
2916 KB |
Output is correct |
74 |
Correct |
212 ms |
3596 KB |
Output is correct |
75 |
Correct |
236 ms |
3784 KB |
Output is correct |
76 |
Correct |
204 ms |
2948 KB |
Output is correct |
77 |
Correct |
572 ms |
8656 KB |
Output is correct |
78 |
Correct |
562 ms |
8676 KB |
Output is correct |
79 |
Correct |
585 ms |
8620 KB |
Output is correct |
80 |
Correct |
569 ms |
8672 KB |
Output is correct |
81 |
Correct |
570 ms |
8592 KB |
Output is correct |
82 |
Correct |
529 ms |
7436 KB |
Output is correct |
83 |
Correct |
533 ms |
7428 KB |
Output is correct |
84 |
Correct |
524 ms |
7400 KB |
Output is correct |
85 |
Correct |
544 ms |
7380 KB |
Output is correct |
86 |
Correct |
549 ms |
7480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
3 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
324 KB |
Output is correct |
14 |
Correct |
3 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
340 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
3 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
368 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
340 KB |
Output is correct |
23 |
Correct |
235 ms |
3600 KB |
Output is correct |
24 |
Correct |
249 ms |
3512 KB |
Output is correct |
25 |
Correct |
231 ms |
3568 KB |
Output is correct |
26 |
Correct |
234 ms |
3844 KB |
Output is correct |
27 |
Correct |
198 ms |
3176 KB |
Output is correct |
28 |
Correct |
244 ms |
3516 KB |
Output is correct |
29 |
Correct |
231 ms |
3772 KB |
Output is correct |
30 |
Correct |
234 ms |
3636 KB |
Output is correct |
31 |
Correct |
232 ms |
3616 KB |
Output is correct |
32 |
Correct |
262 ms |
3688 KB |
Output is correct |
33 |
Correct |
256 ms |
3920 KB |
Output is correct |
34 |
Correct |
258 ms |
3768 KB |
Output is correct |
35 |
Correct |
258 ms |
3788 KB |
Output is correct |
36 |
Correct |
255 ms |
3796 KB |
Output is correct |
37 |
Correct |
212 ms |
3100 KB |
Output is correct |
38 |
Correct |
209 ms |
3060 KB |
Output is correct |
39 |
Correct |
199 ms |
2928 KB |
Output is correct |
40 |
Correct |
212 ms |
2832 KB |
Output is correct |
41 |
Correct |
206 ms |
2848 KB |
Output is correct |
42 |
Correct |
198 ms |
2976 KB |
Output is correct |
43 |
Correct |
597 ms |
9028 KB |
Output is correct |
44 |
Correct |
611 ms |
9048 KB |
Output is correct |
45 |
Correct |
589 ms |
8968 KB |
Output is correct |
46 |
Correct |
595 ms |
9000 KB |
Output is correct |
47 |
Correct |
588 ms |
9012 KB |
Output is correct |
48 |
Correct |
530 ms |
7192 KB |
Output is correct |
49 |
Correct |
513 ms |
6944 KB |
Output is correct |
50 |
Correct |
517 ms |
7000 KB |
Output is correct |
51 |
Correct |
518 ms |
6948 KB |
Output is correct |
52 |
Correct |
513 ms |
6996 KB |
Output is correct |
53 |
Correct |
232 ms |
3532 KB |
Output is correct |
54 |
Correct |
198 ms |
3284 KB |
Output is correct |
55 |
Correct |
222 ms |
3232 KB |
Output is correct |
56 |
Correct |
207 ms |
3312 KB |
Output is correct |
57 |
Correct |
215 ms |
3616 KB |
Output is correct |
58 |
Correct |
218 ms |
3624 KB |
Output is correct |
59 |
Correct |
217 ms |
3632 KB |
Output is correct |
60 |
Correct |
221 ms |
3636 KB |
Output is correct |
61 |
Correct |
224 ms |
3708 KB |
Output is correct |
62 |
Correct |
264 ms |
3932 KB |
Output is correct |
63 |
Correct |
272 ms |
3904 KB |
Output is correct |
64 |
Correct |
273 ms |
3964 KB |
Output is correct |
65 |
Correct |
261 ms |
3832 KB |
Output is correct |
66 |
Correct |
267 ms |
3860 KB |
Output is correct |
67 |
Correct |
205 ms |
2916 KB |
Output is correct |
68 |
Correct |
212 ms |
3596 KB |
Output is correct |
69 |
Correct |
236 ms |
3784 KB |
Output is correct |
70 |
Correct |
204 ms |
2948 KB |
Output is correct |
71 |
Correct |
572 ms |
8656 KB |
Output is correct |
72 |
Correct |
562 ms |
8676 KB |
Output is correct |
73 |
Correct |
585 ms |
8620 KB |
Output is correct |
74 |
Correct |
569 ms |
8672 KB |
Output is correct |
75 |
Correct |
570 ms |
8592 KB |
Output is correct |
76 |
Correct |
529 ms |
7436 KB |
Output is correct |
77 |
Correct |
533 ms |
7428 KB |
Output is correct |
78 |
Correct |
524 ms |
7400 KB |
Output is correct |
79 |
Correct |
544 ms |
7380 KB |
Output is correct |
80 |
Correct |
549 ms |
7480 KB |
Output is correct |
81 |
Correct |
0 ms |
324 KB |
Output is correct |
82 |
Correct |
3 ms |
336 KB |
Output is correct |
83 |
Correct |
3 ms |
340 KB |
Output is correct |
84 |
Correct |
2 ms |
340 KB |
Output is correct |
85 |
Correct |
3 ms |
348 KB |
Output is correct |
86 |
Correct |
3 ms |
340 KB |
Output is correct |
87 |
Incorrect |
181 ms |
4260 KB |
Output isn't correct |
88 |
Halted |
0 ms |
0 KB |
- |