結果

問題 No.135 とりあえず1次元の問題
ユーザー r2en_
提出日時 2017-04-14 20:14:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 434 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 77,004 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 15:18:22
合計ジャッジ時間 1,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int N; scanf("%d",&N);
    vector<int>X(N);
    for(int i = 0; i < N; ++i){ scanf("%d",&X[i]); }
    sort(X.begin(),X.end());
    X.erase(unique(X.begin(),X.end()),X.end());
    int res = 1e9;
    for(int i = 0; i < X.size() - 1; ++i){
        res = min(res,X[i+1]-X[i]);
    }
    cout << (res == 1e9 ? 0 : res) << endl;
    return 0;
}
0