Artifact Content
Not logged in

Artifact 34029dc0172b7ef928ce0e371bdbf9848813a76a


#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 TurretPlacement { public:
	long long count(vector <int> x, vector <int> y) 
	{
		LL cnt = 0;
		for(int i=0; i<x.size(); ++i)
			for(int j=i+1; j<x.size(); ++j)
				cnt += howMany(x[i], y[i], x[j], y[j]);
		return cnt;
	}
	LL howMany(int x, int y, int X, int Y)
	{
		LL n = int(2*sqrt((X-x)*(X-x) + (Y-y)*(Y-y)));
		return (n-1)*n/2;
	}
};

// 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 long long& Expected, const long long& 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(_, TurretPlacement().count(x, y));}
int main(){

CASE(0)
	int x_[] = {0,2};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {0,2};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	long long _ = 10LL; 
END
CASE(1)
	int x_[] = {0,1,2};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {0,1,0};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	long long _ = 8LL; 
END
CASE(2)
	int x_[] = {1,2,3,0};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {-1,-5,-7,100};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	long long _ = 65137LL; 
END
CASE(3)
	int x_[] = {9998,-10000,10000,0};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {9998,10000,10000,0};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	long long _ = 2799564895LL; 
END
CASE(4)
	int x_[] = {0,0};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {1,0};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	long long _ = 0LL; 
END
CASE(5)
	int x_[] = {0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
	int y_[] = {10000,-10000,9000,-9000,8000,-8000,-7000,-7000,6000,-6000,5000,-5000,4000,-4000,3000,-3000,2000,-2000,1000,-1000,
				 9800,- 9800,9500,-9500,8500,-8500,-7500,-7500,6500,-6500,5500,-5500,4500,-4500,3500,-3500,2500,-2500,1500,-1500};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	long long _ = -1LL; 
END

}
// END CUT HERE