結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-23 04:30:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 5,000 ms |
| コード長 | 498 bytes |
| コンパイル時間 | 1,357 ms |
| コンパイル使用メモリ | 162,924 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-17 15:03:01 |
| 合計ジャッジ時間 | 2,290 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define VSORT(v) sort(v.begin(), v.end())
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> x(n);
REP(i, n) cin >> x[i];
VSORT(x);
int ans = INT_MAX;
REP(i, n - 1) {
if (x[i + 1] != x[i]) {
ans = min(ans, x[i + 1] - x[i]);
}
}
if (ans == INT_MAX) ans = 0;
cout << ans << endl;
return 0;
}