Advertisement
YEZAELP

THACO: reunion

Nov 7th, 2020
143
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int n, m;
  6.  
  7. int main(){
  8.  
  9.     scanf("%d%d", &n, &m);
  10.  
  11.     double x[n+1], y[n+1];
  12.     for(int i=1;i<=n;i++){
  13.         scanf("%lf%lf", &x[i], &y[i]);
  14.     }
  15.  
  16.     int ans = 0;
  17.     for(int i=1;i<=m;i++){
  18.         double X, Y, r;
  19.         scanf("%lf%lf%lf", &X, &Y, &r);
  20.         int cnt = 0;
  21.         double L, R, U, D;
  22.         L = (double) X - r;
  23.         R = (double) X + r;
  24.         U = (double) Y + r;
  25.         D = (double) Y - r;
  26.         for(int j=1;j<=n;j++){
  27.             double dis;
  28.             dis = (double)sqrt((double)(X - x[j])*(X - x[j]) + (double)(Y - y[j])*(Y - y[j]));
  29.             if(dis < r and L < x[j] and x[j] < R and y[j] < U and y[j] > D) cnt ++;
  30.         }
  31.         if(cnt < n and cnt > 0) ans ++;
  32.     }
  33.  
  34.     printf("%d", ans);
  35.  
  36.     return 0;
  37. }
Advertisement
RAW Paste Data Copied
Advertisement