結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
Yut176
|
| 提出日時 | 2016-09-06 16:18:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 5,000 ms |
| コード長 | 526 bytes |
| コンパイル時間 | 543 ms |
| コンパイル使用メモリ | 69,628 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 06:55:25 |
| 合計ジャッジ時間 | 1,417 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<string>
#include<sstream>
#include<math.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());
int ans = 10000000;
for(int i=0; i<n-1; i++){
if( x[i+1] == x[i] ) continue;
if( ans > x[i+1]-x[i] ){
ans = x[i+1]-x[i];
}
}
if( ans == 10000000 ) cout << 0 << endl;
else cout << ans << endl;
return 0;
}
Yut176