結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2024-11-19 18:11:54 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 37 ms / 5,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 3,021 ms |
コンパイル使用メモリ | 250,332 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-19 18:11:58 |
合計ジャッジ時間 | 4,482 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h>#define For(i, a, b) for(int i = a; i < b; i++)#define rep(i, n) For(i, 0, n)#define rFor(i, a, b) for(int i = a; i >= b; i--)#define ALL(v) (v).begin(), (v).end()#define rALL(v) (v).rbegin(), (v).rend()using namespace std;using lint = long long;using ld = long double;int INF = 2000000000;lint LINF = 1000000000000000000;int main() {int n;cin >> n;vector<int> x(n);rep(i, n) {cin >> x[i];}sort(ALL(x));x.erase(unique(ALL(x)), x.end());if (x.size() == 1) {cout << 0 << endl;return 0;}int ans = INF;rep(i, (int)x.size() - 1) {ans = min(ans, x[i + 1] - x[i]);}cout << ans << endl;}