Submission #2699594


Source Code Expand

/*input
3 5
6 9 3
*/

#include <bits/stdc++.h>
 
using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con))) 
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)   for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)
 
using ll = long long;
using ss = stringstream;
using ul = unsigned long long;
 
template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) { 
  FH(it,s) 
    *it = tolower(*it); 
} 
 
inline void upper(string &s) { 
  FH(it,s) 
    *it = toupper(*it); 
}

const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
} 

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n) 
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

int main ()
{
    fast;
    int n;
    ll k;
    cin >> n >> k;

    vector < ll > v(n);
    ll ma = 0;
    for(int i = 0; i < n; i ++) {
        cin >> v[i];
        ma = max(ma, v[i]);
    }
    
    ll g = v[0];
    for(int i = 1; i < n; i ++) {
        g = __gcd(v[i], g);
    }
    if(k % g == 0 and k <= ma) {
        cout << "POSSIBLE";
    }
    else {
        cout << "IMPOSSIBLE";
    }
    nl;
    return 0;
}

Submission Info

Submission Time
Task A - Getting Difference
User lowjack
Language C++14 (GCC 5.4.1)
Score 300
Code Size 2807 Byte
Status AC
Exec Time 12 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 19
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 12 ms 1024 KB
subtask_1_04.txt AC 12 ms 1024 KB
subtask_1_05.txt AC 7 ms 640 KB
subtask_1_06.txt AC 3 ms 384 KB
subtask_1_07.txt AC 8 ms 768 KB
subtask_1_08.txt AC 11 ms 1024 KB
subtask_1_09.txt AC 6 ms 512 KB
subtask_1_10.txt AC 9 ms 768 KB
subtask_1_11.txt AC 10 ms 896 KB