Submission #638877

# Submission time Handle Problem Language Result Execution time Memory
638877 2022-09-07T18:58:47 Z endy Wish (LMIO19_noras) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

constexpr long long MAXN=2e5+10;
constexpr long long INF = 1e19;

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

noras.cpp:6:27: warning: overflow in conversion from 'double' to 'long long int' changes value from '1.0e+19' to '9223372036854775807' [-Woverflow]
    6 | constexpr long long INF = 1e19;
      |                           ^~~~
noras.cpp:6:27: error: overflow in constant expression [-fpermissive]
noras.cpp:6:27: error: overflow in constant expression [-fpermissive]
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;
      |                                ^