// No.135 とりあえず1次元の問題 // https://yukicoder.me/problems/no/135 // #include #include #include using namespace std; int main() { unsigned int N; cin >> N; priority_queue pq; for (auto i = 0; i < N; ++i) { int t; cin >> t; pq.push(t); } const int MIN_DIFF_INIT = 999999999; int min_diff = MIN_DIFF_INIT; int prev = pq.top(); pq.pop(); while (!pq.empty()) { int current = pq.top(); pq.pop(); if (current != prev) { min_diff = min(prev - current, min_diff); prev = current; } } if (min_diff != MIN_DIFF_INIT) cout << min_diff << endl; else cout << 0 << endl; }