結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2020-03-21 16:02:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 43 ms / 5,000 ms |
コード長 | 340 bytes |
コンパイル時間 | 1,662 ms |
コンパイル使用メモリ | 170,864 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 00:51:41 |
合計ジャッジ時間 | 2,720 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; signed main(){ int n;cin>>n; vector<int> v(n); for(int i=0;i<n;i++)cin>>v[i]; sort(v.begin(),v.end()); int ans=1e9; for(int i=1;i<n;i++){ if(v[i]==v[i-1])continue; ans=min(ans,v[i]-v[i-1]); } if(ans>1e8)cout<<0<<endl; else cout<<ans<<endl; }