Artifact cddace57bcfd8713dac3419a86fc4a73e082606c
#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 SilverDistance { public:
int minSteps(int sx, int sy, int gx, int gy)
{
return abs(sx-gx)%2 == abs(sy-gy)%2
? max(abs(sx-gx),abs(sy-gy)) : 1+max(abs(sx-gx),abs(sy+1-gy));
}
};
// 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(_, SilverDistance().minSteps(sx, sy, gx, gy));}
int main(){
CASE(0)
int sx = 1;
int sy = 0;
int gx = 1;
int gy = 9;
int _ = 9;
END
CASE(1)
int sx = 0;
int sy = 0;
int gx = -4;
int gy = 3;
int _ = 5;
END
CASE(2)
int sx = 0;
int sy = 0;
int gx = 5;
int gy = 8;
int _ = 8;
END
CASE(3)
int sx = -487617;
int sy = 826524;
int gx = 892309;
int gy = -918045;
int _ = 1744571;
END
CASE(4)
int sx = -27857;
int sy = 31475;
int gx = -27857;
int gy = 31475;
int _ = 0;
END
}
// END CUT HERE