Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define FOR(i,a,b) for (int i = (a); i < (b); i++)
- #define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
- #define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
- #define FILL(a,value) memset(a, value, sizeof(a))
- #define SZ(a) (int)a.size()
- #define ALL(a) a.begin(), a.end()
- #define PB push_back
- #define MP make_pair
- typedef long long LL;
- typedef vector<int> VI;
- typedef pair<int, int> PII;
- const double PI = acos(-1.0);
- const int INF = 1000 * 1000 * 1000 + 7;
- const LL LINF = INF * (LL) INF;
- const int MAX = 30300;
- const double EPS = 1e-7;
- struct Point
- {
- double x, y;
- Point(double x, double y)
- {
- this->x = x;
- this->y = y;
- }
- Point(){}
- } A[MAX];
- int main()
- {
- //freopen("in.txt", "r", stdin);
- //ios::sync_with_stdio(false); cin.tie(0);
- int n;
- while(scanf("%d", &n) != EOF)
- {
- double a;
- scanf("%lf", &a);
- FOR (i, 0, n)
- {
- scanf("%lf", &A[i].x);
- }
- FOR (i, 0, n)
- {
- scanf("%lf", &A[i].y);
- }
- int cnt = 0;
- vector<pair<double, int> > E;
- FOR (i, 0, n)
- {
- if (abs(A[i].x) < 0 && abs(A[i].y) < 0)
- {
- cnt++;
- continue;
- }
- double r2 = A[i].x * A[i].x + A[i].y * A[i].y;
- double d = 1 + 4 * a * a * r2;
- double x = (sqrt(d) - 1) / (2*a);
- double y = sqrt(r2 - x*x);
- double a1 = atan2(A[i].y, A[i].x);
- double a2 = atan2(y, x);
- double ang1 = a1 - a2;
- double ang2 = a1 + a2;
- while(ang1 < EPS) ang1 += 2 * PI;
- while(ang1 > 2*PI - EPS) ang1 -= 2*PI;
- while(ang2 < EPS) ang2 += 2 * PI;
- while(ang2 > 2*PI - EPS) ang2 -= 2*PI;
- E.PB(MP(ang1 - EPS, 1));
- E.PB(MP(ang2 + EPS, -1));
- if (ang1 > ang2) cnt++;
- }
- sort(ALL(E));
- int res = cnt;
- FOR (i, 0, SZ(E))
- {
- cnt += E[i].second;
- res = max(res, cnt);
- }
- printf("%d daze\n", res);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement