結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
suibaka_ku
|
| 提出日時 | 2017-03-08 10:08:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 5,000 ms |
| コード長 | 499 bytes |
| コンパイル時間 | 998 ms |
| コンパイル使用メモリ | 86,244 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 20:52:26 |
| 合計ジャッジ時間 | 1,937 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;
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 res = 1e9;
for(int i=0; i<x.size()-1; ++i) {
res = min(res, x[i+1]-x[i]);
}
cout << (res == 1e9 ? 0 : res) << endl;
}
suibaka_ku