Submission #1445296
Source Code Expand
#include <bits/stdc++.h>
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
const long mod = 1000000007;
template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
scan1(x); scan(xs...);
}
struct Solver {
Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
long gcd(long x, long y) {
if( y == 0 ) return x;
return gcd(y, x%y);
}
void solve() {
long n, k; scan(n, k);
LI xs(n); for(long &x : xs) scan(x);
long z = xs[0];
for(long x : xs) z = gcd(z, x);
long max = xs[0];
for(long x : xs) max = std::max(max, x);
puts( ( k%z==0 and k <= max ) ? "POSSIBLE" : "IMPOSSIBLE" );
}
};
int main() {
loop std::unique_ptr<Solver>(new Solver())->solve();
}
Submission Info
Submission Time |
|
Task |
A - Getting Difference |
User |
spica314 |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1883 Byte |
Status |
AC |
Exec Time |
15 ms |
Memory |
1024 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 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 |
AC |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
sample_03.txt |
AC |
1 ms |
256 KB |
sample_04.txt |
AC |
1 ms |
256 KB |
subtask_1_01.txt |
AC |
1 ms |
256 KB |
subtask_1_02.txt |
AC |
1 ms |
256 KB |
subtask_1_03.txt |
AC |
15 ms |
1024 KB |
subtask_1_04.txt |
AC |
13 ms |
1024 KB |
subtask_1_05.txt |
AC |
8 ms |
640 KB |
subtask_1_06.txt |
AC |
3 ms |
384 KB |
subtask_1_07.txt |
AC |
9 ms |
768 KB |
subtask_1_08.txt |
AC |
13 ms |
896 KB |
subtask_1_09.txt |
AC |
6 ms |
512 KB |
subtask_1_10.txt |
AC |
11 ms |
768 KB |
subtask_1_11.txt |
AC |
12 ms |
896 KB |