Artifact b7df62dcd4535e427fd7f935cf03b86decd22787
#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 RadarFinder { public:
int possibleLocations(int x1, int y1, int r1, int x2, int y2, int r2)
{
if( x1==x2 && y1==y2 )
return r1==r2 ? -1 : 0;
LL rr = LL(x1-x2)*(x1-x2) + LL(y1-y2)*(y1-y2);
LL p12 = LL(r1+r2)*(r1+r2);
LL m12 = LL(r1-r2)*(r1-r2);
if( rr > p12 )
return 0;
else if( rr == p12 )
return 1;
else
if( rr < m12 )
return 0;
else if( rr == m12 )
return 1;
else
return 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 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(_, RadarFinder().possibleLocations(x1, y1, r1, x2, y2, r2));}
int main(){
CASE(0)
int x1 = 0;
int y1 = 0;
int r1 = 13;
int x2 = 40;
int y2 = 0;
int r2 = 37;
int _ = 2;
END
CASE(1)
int x1 = 0;
int y1 = 0;
int r1 = 3;
int x2 = 0;
int y2 = 7;
int r2 = 4;
int _ = 1;
END
CASE(2)
int x1 = 0;
int y1 = 0;
int r1 = 5;
int x2 = 10;
int y2 = 10;
int r2 = 3;
int _ = 0;
END
CASE(3)
int x1 = 0;
int y1 = 0;
int r1 = 1;
int x2 = 0;
int y2 = 0;
int r2 = 1;
int _ = -1;
END
CASE(4)
int x1 = 1;
int y1 = 1;
int r1 = 1;
int x2 = 1;
int y2 = 1;
int r2 = 2;
int _ = 0;
END
CASE(5)
int x1 = -100000000;
int y1 = -100000000;
int r1 = 141421357;
int x2 = 100000000;
int y2 = 100000000;
int r2 = 141421357;
int _ = 2;
END
CASE(6)
int x1 = 0;
int y1 = 0;
int r1 = 5;
int x2 = 1;
int y2 = 0;
int r2 = 4;
int _ = 1;
END
CASE(7)
int x1 = -1000000000;
int y1 = -1000000000;
int r1 = 1000000000;
int x2 = -999999999;
int y2 = 1000000000;
int r2 = 1000000000;
int _ = 0;
END
}
// END CUT HERE