結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2016-02-28 18:48:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 47 ms / 5,000 ms |
コード長 | 345 bytes |
コンパイル時間 | 801 ms |
コンパイル使用メモリ | 64,636 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 14:06:21 |
合計ジャッジ時間 | 1,827 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<iostream> #include<algorithm> using namespace std; #define NMAX 100000 #define INF 10000000 int main(){ int N,X[NMAX]; int ans=INF; cin>>N; for(int i=0;i<N;i++) cin>>X[i]; sort(X,X+N); for(int i=0;i<N-1;i++){ int dis=X[i+1]-X[i]; if(dis<ans&&dis!=0) ans=dis; } if(ans==INF) cout<<"0"<<endl; else cout<<ans<<endl; }