結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2016-02-29 17:11:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 378 bytes |
| コンパイル時間 | 1,046 ms |
| コンパイル使用メモリ | 70,608 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-01-03 14:06:46 |
| 合計ジャッジ時間 | 2,291 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 11 WA * 11 |
ソースコード
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int ans = 10000000,n;
cin >> n;
if(n == 1){
cout << 0 << endl;
return 0;
}
int x[n];
for(int i = 0;i < n;i++) cin >> x[i];
stable_sort(x,x + n);
for(int i = 1;i < n - 1;i++) ans = min({ans,x[i] - x[i - 1],x[i + 1] - x[i]});
cout << ans << endl;
}
ldsyb