結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
|
提出日時 | 2019-07-16 10:38:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 356 bytes |
コンパイル時間 | 1,360 ms |
コンパイル使用メモリ | 163,540 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-30 04:27:40 |
合計ジャッジ時間 | 2,262 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 11 WA * 11 |
ソースコード
#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()); if(n==1)cout<<0<<endl; else{ int ans=INF; for(int i=0;i<n-1;i++){ ans = min(ans, x[i+1]-x[i]); } cout<<ans<<endl; } }