#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" ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |