結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2015-10-26 17:43:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 592 bytes |
コンパイル時間 | 1,456 ms |
コンパイル使用メモリ | 160,656 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 07:59:28 |
合計ジャッジ時間 | 2,637 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #define PB push_back #define MP make_pair #define REP(i,n) for (int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define ALL(a) (a).begin(),(a).end() using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> P; const int INF=1e9; int main(){ int n; cin>>n; vector<int> x(n); REP(i,n)cin>>x[i]; sort(ALL(x)); x.erase(unique(ALL(x)),x.end()); int ans=INF; REP(i,x.size())if(i!=0)ans=min(ans,x[i]-x[i-1]); if(ans!=INF)cout<<ans<<endl; else cout<<0<<endl; }