Submission #1519585
Source Code Expand
#define TEST_MODE true
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a; \
c > 0 ? i < b : i > b; \
i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
#ifdef LOCAL_ENV
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x)
#endif
#else
const bool test = false;
#define dump(x)
#endif
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
//.....................
const int MAX = (int)2e5 + 5;
vector<string> split(const string &str, char sep)
{
vector<string> v;
stringstream ss(str);
string buffer;
while (getline(ss, buffer, sep))
{
v.push_back(buffer);
}
return v;
}
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
return accumulate(begin, end, 0ll);
}
template<typename T>
T gcd(T a, T b)
{
T c;
while (a != 0) {
c = a; a = b%a; b = c;
}
return b;
}
void solve();
class Solver {
public:
int N, K;
int A[MAX];
vector<int> B;
bool ok() {
rep(i, N) {
if (A[i] == K) {
return true;
}
}
rep(i, 2000000) {
int v1 = A[rand() % N];
int v2 = A[rand() % N];
if (v1 < v2) swap(v1, v2);
if (v1 % v2 == 1 or gcd(v1, v2) == 1) {
return true;
}
if (K % (v1 % v2) == 0 or K % gcd(v1, v2) == 0) {
return true;
}
}
return false;
}
void solve() {
cin >> N >> K;
rep(i, N) cin >> A[i];
cout << (ok() ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
};
signed main()
{
cout << fixed << setprecision(20);
auto ptr = new Solver();
ptr->solve();
delete ptr;
// while (true) {
// auto ptr = new Solver();
// ptr->solve();
// delete ptr;
// }
return 0;
}
// class Mycin {
// bool flag = true;
// public:
// Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// operator bool() {return flag;}
// } mycin;
// class Mycout {
// public:
// Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// Mycout& operator << (const char c) {printf("%c", c); return *this;}
// Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
// #define cin mycin
// #define cout mycout
// #define endl '\n'
Submission Info
Submission Time |
|
Task |
A - Getting Difference |
User |
naimonon77 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
3621 Byte |
Status |
RE |
Exec Time |
126 ms |
Memory |
1792 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt |
Case Name |
Status |
Exec Time |
Memory |
sample_01.txt |
RE |
99 ms |
1792 KB |
sample_02.txt |
RE |
98 ms |
1792 KB |
sample_03.txt |
AC |
2 ms |
1792 KB |
sample_04.txt |
RE |
99 ms |
1792 KB |
subtask_1_01.txt |
AC |
2 ms |
1792 KB |
subtask_1_02.txt |
RE |
97 ms |
1792 KB |
subtask_1_03.txt |
AC |
40 ms |
1792 KB |
subtask_1_04.txt |
AC |
40 ms |
1792 KB |
subtask_1_05.txt |
RE |
117 ms |
1792 KB |
subtask_1_06.txt |
AC |
7 ms |
1792 KB |
subtask_1_07.txt |
RE |
121 ms |
1792 KB |
subtask_1_08.txt |
WA |
42 ms |
1792 KB |
subtask_1_09.txt |
AC |
17 ms |
1792 KB |
subtask_1_10.txt |
RE |
126 ms |
1792 KB |
subtask_1_11.txt |
WA |
32 ms |
1792 KB |