Artifact d18b982672b1ce1e4dc8a5822535a66378ffa6a4
#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 <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
int gcd(int a, int b)
{
while (a)
swap(a, b %= a);
return b;
}
class FoxAndCake2 { public:
string isPossible(int c, int s)
{
return solve(c, s) ? "Possible" : "Impossible";
}
bool solve(int a, int b)
{
if (gcd(a, b) != 1)
return true;
for (int x = 2; x <= 100 && x < a; ++x)
for (int y = 2; y <= 100 && y < b; ++y)
if (gcd(x, y) != 1 && gcd(a - x, b - y) != 1)
return true;
return false;
}
};
// 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(_, FoxAndCake2().isPossible(c, s));}
int main(){
CASE(0)
int c = 74;
int s = 109;
string _ = "Possible";
END
CASE(1)
int c = 1000000000;
int s = 1000000000;
string _ = "Possible";
END
CASE(2)
int c = 1;
int s = 58;
string _ = "Impossible";
END
CASE(3)
int c = 223092871;
int s = 446185741;
string _ = "Possible";
END
/*
CASE(4)
int c = ;
int s = ;
string _ = ;
END
*/
}
// END CUT HERE