結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
|
提出日時 | 2024-06-22 22:49:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 1,577 ms |
コンパイル使用メモリ | 173,604 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 22:49:37 |
合計ジャッジ時間 | 2,693 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; template <typename tp> void show(vector<tp> v){ for(ll i=0;i<v.size()-1;i++) cout<<v[i]<<" "; cout<<v[v.size()-1]<<endl; } int main(){ ll n; cin>>n; vector<ll> x(n); for(ll i=0;i<n;i++) cin>>x[i]; vector<ll> diff(n-1); sort(x.begin(),x.end()); for(ll i=0;i<n-1;i++) diff[i]=x[i+1]-x[i]; show(diff); ll ans=pow(10,9); for(ll i=0;i<n-1;i++) if(ans>diff[i]&&diff[i]!=0) ans=diff[i]; cout<<ans<<endl; }