結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
|
提出日時 | 2019-07-16 10:41:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 37 ms / 5,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 1,306 ms |
コンパイル使用メモリ | 161,876 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 04:30:58 |
合計ジャッジ時間 | 2,428 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1<<30; int main(){ int n;cin>>n; vector<int> x(n); for(int i=0;i<n;i++){ cin>>x[i]; } sort(x.begin(), x.end()); int ans=INF; for(int i=0;i<n-1;i++){ if(x[i+1]==x[i])continue; ans = min(ans, x[i+1]-x[i]); } if(ans==INF)ans=0; cout<<ans<<endl; }