結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
|
提出日時 | 2019-08-27 15:13:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2,410 ms / 5,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 1,640 ms |
コンパイル使用メモリ | 162,996 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 19:28:47 |
合計ジャッジ時間 | 12,278 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int n,ans; cin>>n; vector<int> a; for(int i=0;i<n;++i){ int x; cin>>x; if(find(a.begin(),a.end(),x)==a.end())a.emplace_back(x); } ans=(a.size()>1?1e9:0); sort(a.begin(),a.end()); for(int i=1;i<a.size();++i){ ans=min(ans,abs(a[i]-a[i-1])); } cout<<ans<<endl; }