Artifact Content
Not logged in

Artifact 64a4787ef91ae507e5f80124e6eb57f8afa2479c


#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 CompositeSmash { public:
	string thePossible(int N, int target)
	{
		return avoid(N, target) ? "No" : "Yes";
	}

	bool avoid(LL N, LL T)
	{
		if( N == T )
			return false;
		if( N < T )
			return true;
		bool composit = false;
		for(LL d=2; d*d<=N && d<N; ++d)
			if( N%d==0 ) {
				composit = true;
				if( avoid(d,T) && avoid(N/d,T) )
					return true;
			}
		return !composit;
	}
};

// 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 string& Expected, const string& 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(_, CompositeSmash().thePossible(N, target));}
int main(){

CASE(0)
	int N = 517; 
	int target = 47; 
	string _ = "Yes"; 
END
CASE(1)
	int N = 8; 
	int target = 4; 
	string _ = "Yes"; 
END
CASE(2)
	int N = 12; 
	int target = 6; 
	string _ = "No"; 
END
CASE(3)
	int N = 5; 
	int target = 8; 
	string _ = "No"; 
END
CASE(4)
	int N = 100000; 
	int target = 100000; 
	string _ = "Yes"; 
END
CASE(5)
	int N = 5858; 
	int target = 2; 
	string _ = "Yes"; 
END
CASE(6)
	int N = 81461; 
	int target = 2809; 
	string _ = "No"; 
END
CASE(7)
	int N = 65536; 
	int target = 256; 
	string _ = "No"; 
END
/*
CASE(8)
	int N = 72; 
	int target = 4; 
	string _ = "Yes"; 
END
CASE(9)
	int N = ; 
	int target = ; 
	string _ = ; 
END
*/
}
// END CUT HERE