結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2020-04-08 00:27:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 423 bytes |
コンパイル時間 | 1,674 ms |
コンパイル使用メモリ | 171,600 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 10:21:49 |
合計ジャッジ時間 | 2,201 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 1 |
ソースコード
#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 << '\n'; return 0; }