Submission #638882

#TimeUsernameProblemLanguageResultExecution timeMemory
638882PietraWish (LMIO19_noras)C++14
0 / 100
0 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...