Submission #3165135


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
int gcd(int a, int b) { return a ? gcd(b%a, a) : b; }
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/









int N, X, x[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> X;
    rep(i, 0, N) cin >> x[i];

    int ans = 0;
    rep(i, 0, N) ans = gcd(ans, abs(x[i] - X));
    cout << ans << endl;
}

Submission Info

Submission Time
Task C - Skip
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1601 Byte
Status
Exec Time 11 ms
Memory 640 KB

Test Cases

Set Name Score / Max Score Test Cases
All 300 / 300 hand_1, large_1, large_2, large_3, large_4, large_5, large_6, large_7, large_8, max_1, max_2, max_3, min_1, min_2, sample_01, sample_02, sample_03, small_1, small_2, small_3, small_4, small_5
Sample 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_1 1 ms 256 KB
large_1 3 ms 384 KB
large_2 3 ms 384 KB
large_3 3 ms 384 KB
large_4 1 ms 256 KB
large_5 1 ms 256 KB
large_6 1 ms 256 KB
large_7 1 ms 256 KB
large_8 1 ms 256 KB
max_1 11 ms 640 KB
max_2 11 ms 640 KB
max_3 11 ms 640 KB
min_1 1 ms 256 KB
min_2 1 ms 256 KB
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 1 ms 256 KB
small_1 1 ms 256 KB
small_2 1 ms 256 KB
small_3 1 ms 256 KB
small_4 1 ms 256 KB
small_5 1 ms 256 KB