結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-15 12:31:58 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 11 ms / 5,000 ms |
| + 299µs | |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 925 ms |
| コンパイル使用メモリ | 185,896 KB |
| 実行使用メモリ | 9,908 KB |
| 最終ジャッジ日時 | 2026-10-11 11:33:02 |
| 合計ジャッジ時間 | 2,281 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#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;
}