Submission #913262

# Submission time Handle Problem Language Result Execution time Memory
913262 2024-01-20T07:00:39 Z vjudge1 Wish (LMIO19_noras) C++17
100 / 100
180 ms 15676 KB
// #pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")  
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define sz(x) (int)x.size()
#define bit(a, i) ((a>>i)&1)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int P = 18;
const int K = 800;
const ll INF = 2e18;
const int inf = 1e9;
const int mod = 1e9+7;
const int maxm = 5e2+10;
const int maxn = 6e5+10;
const int dx[] = {0, 0, -1, 1};
const int dy[] = {1, -1, 0, 0};

int n, sz;
int pref[maxn];
map<ll, int>cnt;
ll rd, a, b, c, d;

ll C(ll a, ll b){
    return a*a+b*b;
}

ld disc(ld a, ld b, ld c, ld d){
    return 2*a*b*c*d-b*b*(c*c-rd*rd)-d*d*(a*a-rd*rd);
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    vector<pair<ll, ll>>v;
    cin >> n >> rd;
    set<ll>st;
    for(int i=1; i<=n; i++){
        cin >> a >> c >> b >> d;
        b -= a, d -= c;
        ld D = disc(a, b, c, d);
        if(D < 0) continue;
        //cout << D << " ";
        ld x2 = (-a*b-c*d+sqrtl(D))/(b*b+d*d);
        ld x1 = (-a*b-c*d-sqrtl(D))/(b*b+d*d);
        if(x2 < 0ll) continue;
        ll x = ceil(x1);
        ll y = floor(x2);
        x = max(x, 0ll);
        y = max(y, 0ll);
        v.pb({x, y});
        st.insert(x);
        st.insert(y);
    }
    for(auto to: st) cnt[to] = ++sz;
    for(auto to: v){
        if(to.f == -1) continue;
        pref[cnt[to.f]]++;
        pref[cnt[to.s]+1]--;
    } int ans = 0;
    for(int i=1; i<=sz; i++){
        pref[i] += pref[i-1];
        ans = max(ans, pref[i]);
    } cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 736 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 504 KB Output is correct
14 Correct 2 ms 532 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 572 KB Output is correct
18 Correct 1 ms 480 KB Output is correct
19 Correct 2 ms 480 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 736 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 504 KB Output is correct
14 Correct 2 ms 532 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 572 KB Output is correct
18 Correct 1 ms 480 KB Output is correct
19 Correct 2 ms 480 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
23 Correct 35 ms 3684 KB Output is correct
24 Correct 32 ms 3804 KB Output is correct
25 Correct 34 ms 3912 KB Output is correct
26 Correct 47 ms 3732 KB Output is correct
27 Correct 40 ms 3788 KB Output is correct
28 Correct 35 ms 3652 KB Output is correct
29 Correct 32 ms 3876 KB Output is correct
30 Correct 38 ms 3664 KB Output is correct
31 Correct 33 ms 3896 KB Output is correct
32 Correct 49 ms 3908 KB Output is correct
33 Correct 53 ms 4068 KB Output is correct
34 Correct 55 ms 3936 KB Output is correct
35 Correct 48 ms 4064 KB Output is correct
36 Correct 44 ms 3996 KB Output is correct
37 Correct 37 ms 3768 KB Output is correct
38 Correct 34 ms 3800 KB Output is correct
39 Correct 33 ms 3884 KB Output is correct
40 Correct 37 ms 3696 KB Output is correct
41 Correct 36 ms 3792 KB Output is correct
42 Correct 39 ms 3900 KB Output is correct
43 Correct 154 ms 10012 KB Output is correct
44 Correct 158 ms 9964 KB Output is correct
45 Correct 151 ms 9848 KB Output is correct
46 Correct 159 ms 10740 KB Output is correct
47 Correct 180 ms 9912 KB Output is correct
48 Correct 93 ms 8160 KB Output is correct
49 Correct 95 ms 8656 KB Output is correct
50 Correct 100 ms 7892 KB Output is correct
51 Correct 111 ms 7228 KB Output is correct
52 Correct 107 ms 8664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 736 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 504 KB Output is correct
14 Correct 2 ms 532 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 572 KB Output is correct
18 Correct 1 ms 480 KB Output is correct
19 Correct 2 ms 480 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 736 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 504 KB Output is correct
14 Correct 2 ms 532 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 572 KB Output is correct
18 Correct 1 ms 480 KB Output is correct
19 Correct 2 ms 480 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
23 Correct 35 ms 3684 KB Output is correct
24 Correct 32 ms 3804 KB Output is correct
25 Correct 34 ms 3912 KB Output is correct
26 Correct 47 ms 3732 KB Output is correct
27 Correct 40 ms 3788 KB Output is correct
28 Correct 35 ms 3652 KB Output is correct
29 Correct 32 ms 3876 KB Output is correct
30 Correct 38 ms 3664 KB Output is correct
31 Correct 33 ms 3896 KB Output is correct
32 Correct 49 ms 3908 KB Output is correct
33 Correct 53 ms 4068 KB Output is correct
34 Correct 55 ms 3936 KB Output is correct
35 Correct 48 ms 4064 KB Output is correct
36 Correct 44 ms 3996 KB Output is correct
37 Correct 37 ms 3768 KB Output is correct
38 Correct 34 ms 3800 KB Output is correct
39 Correct 33 ms 3884 KB Output is correct
40 Correct 37 ms 3696 KB Output is correct
41 Correct 36 ms 3792 KB Output is correct
42 Correct 39 ms 3900 KB Output is correct
43 Correct 154 ms 10012 KB Output is correct
44 Correct 158 ms 9964 KB Output is correct
45 Correct 151 ms 9848 KB Output is correct
46 Correct 159 ms 10740 KB Output is correct
47 Correct 180 ms 9912 KB Output is correct
48 Correct 93 ms 8160 KB Output is correct
49 Correct 95 ms 8656 KB Output is correct
50 Correct 100 ms 7892 KB Output is correct
51 Correct 111 ms 7228 KB Output is correct
52 Correct 107 ms 8664 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 600 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 34 ms 3824 KB Output is correct
60 Correct 33 ms 3264 KB Output is correct
61 Correct 42 ms 3528 KB Output is correct
62 Correct 34 ms 4568 KB Output is correct
63 Correct 50 ms 3952 KB Output is correct
64 Correct 46 ms 4064 KB Output is correct
65 Correct 51 ms 4148 KB Output is correct
66 Correct 65 ms 3988 KB Output is correct
67 Correct 69 ms 4088 KB Output is correct
68 Correct 59 ms 4068 KB Output is correct
69 Correct 54 ms 4072 KB Output is correct
70 Correct 52 ms 4068 KB Output is correct
71 Correct 51 ms 4152 KB Output is correct
72 Correct 56 ms 4072 KB Output is correct
73 Correct 34 ms 3796 KB Output is correct
74 Correct 37 ms 3792 KB Output is correct
75 Correct 40 ms 3920 KB Output is correct
76 Correct 34 ms 3788 KB Output is correct
77 Correct 162 ms 9940 KB Output is correct
78 Correct 139 ms 9908 KB Output is correct
79 Correct 149 ms 10056 KB Output is correct
80 Correct 150 ms 9656 KB Output is correct
81 Correct 143 ms 10320 KB Output is correct
82 Correct 116 ms 8380 KB Output is correct
83 Correct 120 ms 8324 KB Output is correct
84 Correct 120 ms 9476 KB Output is correct
85 Correct 106 ms 8416 KB Output is correct
86 Correct 111 ms 9316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 736 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 504 KB Output is correct
14 Correct 2 ms 532 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 572 KB Output is correct
18 Correct 1 ms 480 KB Output is correct
19 Correct 2 ms 480 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
23 Correct 35 ms 3684 KB Output is correct
24 Correct 32 ms 3804 KB Output is correct
25 Correct 34 ms 3912 KB Output is correct
26 Correct 47 ms 3732 KB Output is correct
27 Correct 40 ms 3788 KB Output is correct
28 Correct 35 ms 3652 KB Output is correct
29 Correct 32 ms 3876 KB Output is correct
30 Correct 38 ms 3664 KB Output is correct
31 Correct 33 ms 3896 KB Output is correct
32 Correct 49 ms 3908 KB Output is correct
33 Correct 53 ms 4068 KB Output is correct
34 Correct 55 ms 3936 KB Output is correct
35 Correct 48 ms 4064 KB Output is correct
36 Correct 44 ms 3996 KB Output is correct
37 Correct 37 ms 3768 KB Output is correct
38 Correct 34 ms 3800 KB Output is correct
39 Correct 33 ms 3884 KB Output is correct
40 Correct 37 ms 3696 KB Output is correct
41 Correct 36 ms 3792 KB Output is correct
42 Correct 39 ms 3900 KB Output is correct
43 Correct 154 ms 10012 KB Output is correct
44 Correct 158 ms 9964 KB Output is correct
45 Correct 151 ms 9848 KB Output is correct
46 Correct 159 ms 10740 KB Output is correct
47 Correct 180 ms 9912 KB Output is correct
48 Correct 93 ms 8160 KB Output is correct
49 Correct 95 ms 8656 KB Output is correct
50 Correct 100 ms 7892 KB Output is correct
51 Correct 111 ms 7228 KB Output is correct
52 Correct 107 ms 8664 KB Output is correct
53 Correct 34 ms 3824 KB Output is correct
54 Correct 33 ms 3264 KB Output is correct
55 Correct 42 ms 3528 KB Output is correct
56 Correct 34 ms 4568 KB Output is correct
57 Correct 50 ms 3952 KB Output is correct
58 Correct 46 ms 4064 KB Output is correct
59 Correct 51 ms 4148 KB Output is correct
60 Correct 65 ms 3988 KB Output is correct
61 Correct 69 ms 4088 KB Output is correct
62 Correct 59 ms 4068 KB Output is correct
63 Correct 54 ms 4072 KB Output is correct
64 Correct 52 ms 4068 KB Output is correct
65 Correct 51 ms 4152 KB Output is correct
66 Correct 56 ms 4072 KB Output is correct
67 Correct 34 ms 3796 KB Output is correct
68 Correct 37 ms 3792 KB Output is correct
69 Correct 40 ms 3920 KB Output is correct
70 Correct 34 ms 3788 KB Output is correct
71 Correct 162 ms 9940 KB Output is correct
72 Correct 139 ms 9908 KB Output is correct
73 Correct 149 ms 10056 KB Output is correct
74 Correct 150 ms 9656 KB Output is correct
75 Correct 143 ms 10320 KB Output is correct
76 Correct 116 ms 8380 KB Output is correct
77 Correct 120 ms 8324 KB Output is correct
78 Correct 120 ms 9476 KB Output is correct
79 Correct 106 ms 8416 KB Output is correct
80 Correct 111 ms 9316 KB Output is correct
81 Correct 1 ms 344 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 600 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 128 ms 15440 KB Output is correct
88 Correct 97 ms 14332 KB Output is correct
89 Correct 92 ms 12644 KB Output is correct
90 Correct 72 ms 8656 KB Output is correct
91 Correct 76 ms 7168 KB Output is correct
92 Correct 110 ms 15532 KB Output is correct
93 Correct 124 ms 15492 KB Output is correct
94 Correct 98 ms 15676 KB Output is correct
95 Correct 99 ms 15456 KB Output is correct
96 Correct 114 ms 15620 KB Output is correct
97 Correct 41 ms 4300 KB Output is correct
98 Correct 45 ms 4308 KB Output is correct
99 Correct 49 ms 4304 KB Output is correct
100 Correct 43 ms 4424 KB Output is correct
101 Correct 42 ms 4300 KB Output is correct
102 Correct 39 ms 4668 KB Output is correct
103 Correct 49 ms 4420 KB Output is correct
104 Correct 41 ms 4636 KB Output is correct
105 Correct 40 ms 4304 KB Output is correct
106 Correct 41 ms 4424 KB Output is correct