結果

問題 No.135 とりあえず1次元の問題
ユーザー ldsyb
提出日時 2016-02-29 17:07:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 398 bytes
コンパイル時間 833 ms
コンパイル使用メモリ 70,320 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2025-01-03 14:24:51
合計ジャッジ時間 30,474 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17 WA * 1 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
   int ans = 10000000,n;
   cin >> n;
   if(n == 1){
      cout << 0 << endl;
      return 0;
   }
   int x[n];
   for(int i = 0;i < n;i++) cin >> x[i];
   stable_sort(x,x + n);
   for(int i = 0;i < n;i++) for(int j = i + 1;j < n;j++) if(x[i] != x[j]) ans = min(ans,x[j] - x[i]);
   cout << ans << endl;
}
0