結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-06 05:52:18 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 11 ms / 5,000 ms |
| + 371µs | |
| コード長 | 448 bytes |
| 記録 | |
| コンパイル時間 | 449 ms |
| コンパイル使用メモリ | 98,812 KB |
| 実行使用メモリ | 9,904 KB |
| 最終ジャッジ日時 | 2026-10-11 11:35:58 |
| 合計ジャッジ時間 | 2,069 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
if(n==1){
cout << 0 << endl;
return 0;
}
vector<int> a(n);
for(int i=0;i<n;i++){
cin >> a[i];
}
sort(a.begin(),a.end());
int ans=1e9;
for(int i=0;i<n-1;i++){
if(a[i+1]-a[i])ans=min(ans,a[i+1]-a[i]);
}
if(ans==1e9)ans=0;
cout << ans << endl;
}