結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
![]() |
提出日時 | 2016-02-29 17:14:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 381 bytes |
コンパイル時間 | 924 ms |
コンパイル使用メモリ | 70,340 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 14:07:02 |
合計ジャッジ時間 | 2,287 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 1 |
ソースコード
#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 = 0;i < n - 1;i++) if(x[i] != x[i + 1]) ans = min(ans,x[i + 1] - x[i]); cout << ans << endl; }