This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
constexpr long long MAXN=2e5+10;
constexpr long long INF = 1e12;
long long n, r, ans=0, dia[10*MAXN];
vector <long long> coord[5];
int main(){
ios::sync_with_stdio(false); cin.tie(0);
cin >> n >> r;
for(int i=0 ; i<n ; i++){
long long a, b, c, d;
cin >> a >> b >> c >> d;
coord[0].push_back(a);
coord[1].push_back(b);
coord[2].push_back(c);
coord[3].push_back(d);
}
for(int i=0 ; i<n ; i++){
long long a = coord[0][i], b = coord[1][i], c = coord[2][i], d = coord[3][i];
long long x = c-a, y = d-b, cont=1;
long long pdist=INF, blablabla=0;
while(blablabla==0){
long long A = a*a, B = b*b, R = r*r;
long long dist = A+B;
if(dist < 0) dist = (-1)*dist;
//cout << dist << " - dist " << A << " a ao quadrado " << B << " b ao quadrado" << endl;
if(dist <= (r*r)){
dia[cont]++;
ans = max(ans, dia[cont]);
}else if(pdist < dist){
blablabla = 1;
}
cont++;
a+=x;
b+=y;
pdist=dist;
}
//cout << ans << endl;
}
cout << ans << endl;
return 0;
}
Compilation message (stderr)
noras.cpp: In function 'int main()':
noras.cpp:36:32: warning: unused variable 'R' [-Wunused-variable]
36 | long long A = a*a, B = b*b, R = r*r;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |