結果

問題 No.135 とりあえず1次元の問題
ユーザー 0w1
提出日時 2016-11-20 00:08:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 419 bytes
コンパイル時間 1,463 ms
コンパイル使用メモリ 172,108 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 07:08:29
合計ジャッジ時間 2,432 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

signed main(){
  int N; cin >> N;
  vector< int > X( N );
  for( int i = 0; i < N; ++i )
    cin >> X[ i ];
  sort( X.begin(), X.end() );
  X.erase( unique( X.begin(), X.end() ), X.end() );
  int ans = ( int ) 1e9;
  for( int i = 1; i < X.size(); ++i )
    ans = min( ans, X[ i ] - X[ i - 1 ] );
  if( ans == ( int ) 1e9 )
    ans = 0;
  cout << ans << endl;
  return 0;
}
0