Skip to content

Instantly share code, notes, and snippets.

@roy4801
Created September 4, 2019 07:20
Show Gist options
  • Save roy4801/1295ac637944dd0b1f73165872f7ce56 to your computer and use it in GitHub Desktop.
Save roy4801/1295ac637944dd0b1f73165872f7ce56 to your computer and use it in GitHub Desktop.
/*
* HOJ 464 - 菇菇園
* author: roy4801
* (C++)
*/
#include <bits/stdc++.h>
using namespace std;
#define PROB "464"
#define TESTC ""
#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;
#define F first
#define S second
#define INF 0x3f3f3f3f
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PPB pop_back
#define PF push_front
#define PPF pop_front
#define N 100
int kase;
int n, m, k; // mushroom, infected, distance
int x, y;
PLL nor;
vector<PLL> inf;
inline LL dis2(PLL a, PLL b)
{
LL tmp = a.F-b.F, tmp2 = a.S-b.S;
return tmp*tmp + tmp2*tmp2;
}
int main()
{
#ifdef DBG
freopen("./testdata/" PROB TESTC ".in", "r", stdin);
freopen("./testdata/" PROB ".out", "w", stdout);
#endif
USE_CPPIO();
cin >> kase;
while(kase-- && cin >> n >> m >> k)
{
inf.clear();
k *= k;
for(int i = 0; i < n && cin >> x >> y; i++)
{
if(i < m)
inf.PB(MP(x, y));
else
{
nor = MP(x, y);
for(auto &p : inf)
{
if(dis2(p, nor) <= k)
{
inf.PB(nor);
break;
}
}
}
}
cout << inf.size() << '\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment