Artifact Content
Not logged in

Artifact d971d0647e4bd58eefa6f4034a87597e8eaa3d19


#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>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class MagicDiamonds { public:
	long long minimalTransfer(long long n)
	{
		if( n <= 3 )
			return n;
		for(LL p=2; p*p<=n && p<n; ++p)
			if( n%p == 0 )
				return 1;
		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 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(_, MagicDiamonds().minimalTransfer(n));}
int main(){

CASE(0)
	long long n = 2LL; 
	long long _ = 2LL; 
END
CASE(1)
	long long n = 4294967297LL; 
	long long _ = 1LL; 
END
CASE(2)
	long long n = 2147483647LL; 
	long long _ = 2LL; 
END
CASE(3)
	long long n = 1LL; 
	long long _ = 1LL; 
END
CASE(4)
	long long n = 1000000000000LL; 
	long long _ = -1LL; 
END
/*
CASE(5)
	long long n = LL; 
	long long _ = LL; 
END
*/
}
// END CUT HERE