# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
770966 |
2023-07-02T08:22:45 Z |
dxz05 |
Wish (LMIO19_noras) |
C++17 |
|
1000 ms |
8340 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 __int128
void solve(){
int n; ll R;
cin >> n >> R;
R *= R;
ld lim = 3e9;
vector<ld> st, en;
map<ld, int> mp;
for (int i = 1; i <= n; i++){
ll 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
5 ms |
368 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
4 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
7 ms |
340 KB |
Output is correct |
15 |
Correct |
7 ms |
340 KB |
Output is correct |
16 |
Correct |
6 ms |
404 KB |
Output is correct |
17 |
Correct |
6 ms |
340 KB |
Output is correct |
18 |
Correct |
6 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
380 KB |
Output is correct |
22 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
5 ms |
368 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
4 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
7 ms |
340 KB |
Output is correct |
15 |
Correct |
7 ms |
340 KB |
Output is correct |
16 |
Correct |
6 ms |
404 KB |
Output is correct |
17 |
Correct |
6 ms |
340 KB |
Output is correct |
18 |
Correct |
6 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
380 KB |
Output is correct |
22 |
Correct |
5 ms |
340 KB |
Output is correct |
23 |
Correct |
597 ms |
3964 KB |
Output is correct |
24 |
Correct |
552 ms |
4260 KB |
Output is correct |
25 |
Correct |
546 ms |
4188 KB |
Output is correct |
26 |
Correct |
554 ms |
4048 KB |
Output is correct |
27 |
Correct |
442 ms |
2688 KB |
Output is correct |
28 |
Correct |
530 ms |
4036 KB |
Output is correct |
29 |
Correct |
530 ms |
3912 KB |
Output is correct |
30 |
Correct |
540 ms |
3964 KB |
Output is correct |
31 |
Correct |
527 ms |
4024 KB |
Output is correct |
32 |
Correct |
587 ms |
4064 KB |
Output is correct |
33 |
Correct |
596 ms |
4136 KB |
Output is correct |
34 |
Correct |
595 ms |
4072 KB |
Output is correct |
35 |
Correct |
588 ms |
4144 KB |
Output is correct |
36 |
Correct |
599 ms |
3988 KB |
Output is correct |
37 |
Correct |
487 ms |
3188 KB |
Output is correct |
38 |
Correct |
518 ms |
2944 KB |
Output is correct |
39 |
Correct |
450 ms |
2540 KB |
Output is correct |
40 |
Correct |
463 ms |
2860 KB |
Output is correct |
41 |
Correct |
446 ms |
2588 KB |
Output is correct |
42 |
Correct |
457 ms |
2572 KB |
Output is correct |
43 |
Execution timed out |
1022 ms |
8340 KB |
Time limit exceeded |
44 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
5 ms |
368 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
4 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
7 ms |
340 KB |
Output is correct |
15 |
Correct |
7 ms |
340 KB |
Output is correct |
16 |
Correct |
6 ms |
404 KB |
Output is correct |
17 |
Correct |
6 ms |
340 KB |
Output is correct |
18 |
Correct |
6 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
380 KB |
Output is correct |
22 |
Correct |
5 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
9 ms |
340 KB |
Output is correct |
25 |
Correct |
7 ms |
388 KB |
Output is correct |
26 |
Correct |
5 ms |
340 KB |
Output is correct |
27 |
Correct |
6 ms |
384 KB |
Output is correct |
28 |
Correct |
6 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
5 ms |
368 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
4 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
7 ms |
340 KB |
Output is correct |
15 |
Correct |
7 ms |
340 KB |
Output is correct |
16 |
Correct |
6 ms |
404 KB |
Output is correct |
17 |
Correct |
6 ms |
340 KB |
Output is correct |
18 |
Correct |
6 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
380 KB |
Output is correct |
22 |
Correct |
5 ms |
340 KB |
Output is correct |
23 |
Correct |
597 ms |
3964 KB |
Output is correct |
24 |
Correct |
552 ms |
4260 KB |
Output is correct |
25 |
Correct |
546 ms |
4188 KB |
Output is correct |
26 |
Correct |
554 ms |
4048 KB |
Output is correct |
27 |
Correct |
442 ms |
2688 KB |
Output is correct |
28 |
Correct |
530 ms |
4036 KB |
Output is correct |
29 |
Correct |
530 ms |
3912 KB |
Output is correct |
30 |
Correct |
540 ms |
3964 KB |
Output is correct |
31 |
Correct |
527 ms |
4024 KB |
Output is correct |
32 |
Correct |
587 ms |
4064 KB |
Output is correct |
33 |
Correct |
596 ms |
4136 KB |
Output is correct |
34 |
Correct |
595 ms |
4072 KB |
Output is correct |
35 |
Correct |
588 ms |
4144 KB |
Output is correct |
36 |
Correct |
599 ms |
3988 KB |
Output is correct |
37 |
Correct |
487 ms |
3188 KB |
Output is correct |
38 |
Correct |
518 ms |
2944 KB |
Output is correct |
39 |
Correct |
450 ms |
2540 KB |
Output is correct |
40 |
Correct |
463 ms |
2860 KB |
Output is correct |
41 |
Correct |
446 ms |
2588 KB |
Output is correct |
42 |
Correct |
457 ms |
2572 KB |
Output is correct |
43 |
Execution timed out |
1022 ms |
8340 KB |
Time limit exceeded |
44 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
5 ms |
368 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
4 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
7 ms |
340 KB |
Output is correct |
15 |
Correct |
7 ms |
340 KB |
Output is correct |
16 |
Correct |
6 ms |
404 KB |
Output is correct |
17 |
Correct |
6 ms |
340 KB |
Output is correct |
18 |
Correct |
6 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
380 KB |
Output is correct |
22 |
Correct |
5 ms |
340 KB |
Output is correct |
23 |
Correct |
597 ms |
3964 KB |
Output is correct |
24 |
Correct |
552 ms |
4260 KB |
Output is correct |
25 |
Correct |
546 ms |
4188 KB |
Output is correct |
26 |
Correct |
554 ms |
4048 KB |
Output is correct |
27 |
Correct |
442 ms |
2688 KB |
Output is correct |
28 |
Correct |
530 ms |
4036 KB |
Output is correct |
29 |
Correct |
530 ms |
3912 KB |
Output is correct |
30 |
Correct |
540 ms |
3964 KB |
Output is correct |
31 |
Correct |
527 ms |
4024 KB |
Output is correct |
32 |
Correct |
587 ms |
4064 KB |
Output is correct |
33 |
Correct |
596 ms |
4136 KB |
Output is correct |
34 |
Correct |
595 ms |
4072 KB |
Output is correct |
35 |
Correct |
588 ms |
4144 KB |
Output is correct |
36 |
Correct |
599 ms |
3988 KB |
Output is correct |
37 |
Correct |
487 ms |
3188 KB |
Output is correct |
38 |
Correct |
518 ms |
2944 KB |
Output is correct |
39 |
Correct |
450 ms |
2540 KB |
Output is correct |
40 |
Correct |
463 ms |
2860 KB |
Output is correct |
41 |
Correct |
446 ms |
2588 KB |
Output is correct |
42 |
Correct |
457 ms |
2572 KB |
Output is correct |
43 |
Execution timed out |
1022 ms |
8340 KB |
Time limit exceeded |
44 |
Halted |
0 ms |
0 KB |
- |