Artifact Content
Not logged in

Artifact 9e9e07b8082e082d9772b58ff34994f7674084f7


#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class CirclesCountry { public:
	int leastBorders(vector <int> X, vector <int> Y, vector <int> R, int x1, int y1, int x2, int y2) 
	{
		int cnt = 0;
		for(int i=0; i<X.size(); ++i)
			cnt += hypot(X[i]-x1, Y[i]-y1)<R[i] ^ hypot(X[i]-x2, Y[i]-y2)<R[i];
		return cnt;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, CirclesCountry().leastBorders(X, Y, R, x1, y1, x2, y2));}
int main(){

CASE(0)
	int X_[] = {0};
	  vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 
	int Y_[] = {0};
	  vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 
	int R_[] = {2};
	  vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 
	int x1 = -5; 
	int y1 = 1; 
	int x2 = 5; 
	int y2 = 1; 
	int _ = 0; 
END
CASE(1)
	int X_[] = {0,-6,6};
	  vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 
	int Y_[] = {0,1,2};
	  vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 
	int R_[] = {2,2,2};
	  vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 
	int x1 = -5; 
	int y1 = 1; 
	int x2 = 5; 
	int y2 = 1; 
	int _ = 2; 
END
CASE(2)
	int X_[] = {1,-3,2,5,-4,12,12};
	  vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 
	int Y_[] = {1,-1,2,5,5,1,1};
	  vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 
	int R_[] = {8,1,2,1,1,1,2};
	  vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 
	int x1 = -5; 
	int y1 = 1; 
	int x2 = 12; 
	int y2 = 1; 
	int _ = 3; 
END
CASE(3)
	int X_[] = {-3,2,2,0,-4,12,12,12};
	  vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 
	int Y_[] = {-1,2,3,1,5,1,1,1};
	  vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 
	int R_[] = {1,3,1,7,1,1,2,3};
	  vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 
	int x1 = 2; 
	int y1 = 3; 
	int x2 = 13; 
	int y2 = 2; 
	int _ = 5; 
END
CASE(4)
	int X_[] = {-107,-38,140,148,-198,172,-179,148,176,153,-56,-187};
	  vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 
	int Y_[] = {175,-115,23,-2,-49,-151,-52,42,0,68,109,-174};
	  vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 
	int R_[] = {135,42,70,39,89,39,43,150,10,120,16,8};
	  vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 
	int x1 = 102; 
	int y1 = 16; 
	int x2 = 19; 
	int y2 = -108; 
	int _ = 3; 
END
CASE(5)
	int X_[] = {0};
	  vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 
	int Y_[] = {0};
	  vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 
	int R_[] = {2};
	  vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 
	int x1 = -5; 
	int y1 = 1; 
	int x2 = 2; 
	int y2 = 2; 
	int _ = 0; 
END

}
// END CUT HERE