結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
|
提出日時 | 2019-07-15 12:31:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 395 bytes |
コンパイル時間 | 1,641 ms |
コンパイル使用メモリ | 172,716 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-26 22:33:22 |
合計ジャッジ時間 | 2,681 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define INF 100000000 int main() { cin.tie(0); ios::sync_with_stdio(false); int n, d = INF; cin >> n; vector<int> x(n); for (auto& e : x) cin >> e; sort(x.begin(), x.end()); for (int i = 0; i < n - 1; i++) { if (x[i] != x[i + 1]) { d = min(d, x[i + 1] - x[i]); } } cout << (d != INF ? d : 0) << endl; return 0; }