結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-01-28 18:05:28 |
| 言語 | C++11(old_compat) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 5,000 ms |
| コード長 | 397 bytes |
| 記録 | |
| コンパイル時間 | 1,393 ms |
| コンパイル使用メモリ | 172,692 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-08 16:01:01 |
| 合計ジャッジ時間 | 2,680 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n; cin>>n;
vector<int> a(n);
for(int& v: a) cin>>v;
sort(begin(a), end(a));
a.erase(unique(begin(a), end(a)), end(a));
if (a.size()==1)
cout<<0<<endl;
else {
int res=a[1]-a[0];
for(int i=2;i<a.size();++i) res=min(res, a[i]-a[i-1]);
cout<<res<<endl;
}
}
hogeover30