Submission #1445304


Source Code Expand

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

ll Euclid(ll A, ll B){
    if(A<B) swap(A, B);
    ull C = B;
    while(C != 0){
        C = A%B;
        A = B;
        B = C;
    }
    return A;
}

int main(){
    ll N, K;
    cin >> N >> K;
    ll A[N];
    REP(i, N) cin >> A[i];
    sort(A.begin(), A.end());
    ll gcd = A[0];
    REP(i, N) gcd = Euclid(gcd, A[i]);
    cout << gcd << endl;
    if(K%gcd==0 && K<=A[N-1]){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task A - Getting Difference
User theory_and_me
Language C++14 (GCC 5.4.1)
Score 0
Code Size 780 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:28:12: error: request for member ‘begin’ in ‘A’, which is of non-class type ‘ll [N] {aka long long int [N]}’
     sort(A.begin(), A.end());
            ^
./Main.cpp:28:23: error: request for member ‘end’ in ‘A’, which is of non-class type ‘ll [N] {aka long long int [N]}’
     sort(A.begin(), A.end());
                       ^