結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-16 23:12:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 5,000 ms |
| コード長 | 327 bytes |
| コンパイル時間 | 580 ms |
| コンパイル使用メモリ | 59,584 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-19 04:07:56 |
| 合計ジャッジ時間 | 1,504 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a, a + n);
int x = 1000001;
for(int i = 0; i < n - 1; i++){
if(a[i + 1] != a[i]){
x = min(x, a[i + 1] - a[i]);
}
}
if(x == 1000001) x = 0;
cout<< x <<endl;
}