結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2019-09-24 17:46:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 36 ms / 5,000 ms |
コード長 | 319 bytes |
コンパイル時間 | 1,182 ms |
コンパイル使用メモリ | 162,416 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 05:11:01 |
合計ジャッジ時間 | 2,493 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main() { int n; cin >>n; vector<int>a(n); for(int i=0;i<n;i++){ cin >> a.at(i); } sort(a.begin(),a.end()); int ans =10e8; for(int i=1;i<n;i++){ if(a.at(i)!=a.at(i-1))ans=min(ans,abs(a.at(i)-a.at(i-1))); } if(ans==10e8)cout <<0 <<endl; else cout <<ans<<endl; }