結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2020-05-19 18:51:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 1,704 ms |
コンパイル使用メモリ | 172,524 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-01 22:57:12 |
合計ジャッジ時間 | 2,821 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { 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 ans = 1e7; for (int i = 0; i < X.size() - 1; i++) { ans = min(ans, X[i + 1] - X[i]); } if (ans == 1e7) ans = 0; cout << ans << endl; }