Submission #638882

# Submission time Handle Problem Language Result Execution time Memory
638882 2022-09-07T19:50:54 Z Pietra Wish (LMIO19_noras) C++14
0 / 100
0 ms 212 KB
#include<bits/stdc++.h>
#define int long long
using namespace std ; 

const int maxn = 1e4 + 5 ; 
const int maxx = 2e5 + 5 ; 

int n, r ; 

struct S{
	int xi, xf, yi, yf ; 
} ; 

S st[maxx] ; 

int dist(pair<int,int> a, pair<int,int> b){
	int dx = (a.first - b.first), dy = (a.second - b.second) ; 
	dx *= dx, dy *= dy ; 
	return dx + dy ; 
}

int32_t main(){

	ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; 
	
	cin >> n >> r ; 

	for(int i = 1 ; i <= n ; i++){
		int xi, xf, yi, yf ; cin >> xi >> yi >> xf >> yf ; 
		st[i] = {xi, xf, yi, yf} ;
	}

	int D = r*r ; 

	int ans = 0 ; 

	for(int i = 1 ; i <= n ; i++){
		if(abs(st[i].yi) > r) continue ;
		bool ok = 0 ;  
		if(abs(st[i].xi) <= r || abs(st[i].xf) <= r){ ans++ ; continue ; }
		int v = st[i].xf - st[i].xi ;  
		for(int t = 0 ; t < maxn ; t++){
			int pa = st[i].xf + t*v, pb = st[i].yf ;
			int d = dist({pa, pb}, {0, 0}) ;
			if(d == D){
				ok = 1 ; break ; 
			} 
		}
		if(ok) ans++ ; 
	}

	cout << ans << "\n" ; 

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -