結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー | kyo1 |
提出日時 | 2020-04-08 00:29:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 446 bytes |
コンパイル時間 | 1,479 ms |
コンパイル使用メモリ | 172,816 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 10:24:05 |
合計ジャッジ時間 | 2,361 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<int> X(N); for (int i = 0; i < N; i++) { cin >> X[i]; } sort(X.begin(), X.end()); X.erase(unique(X.begin(), X.end()), X.end()); int res = 1 << 28; for (int i = 0; i < (int)X.size() - 1; i++) { res = min(res, X[i + 1] - X[i]); } cout << (res == 1 << 28 ? 0 : res) << '\n'; return 0; }