結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2016-03-21 03:46:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 5,000 ms |
| コード長 | 859 bytes |
| コンパイル時間 | 1,953 ms |
| コンパイル使用メモリ | 90,648 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-03 14:27:12 |
| 合計ジャッジ時間 | 2,064 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 135.cc: No.135 とりあえず1次元の問題 - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 100000;
const int INF = 1 << 30;
/* typedef */
/* global variables */
int xs[MAX_N];
/* subroutines */
/* main */
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> xs[i];
sort(xs, xs + n);
int mind = INF;
for (int i = 1; i < n; i++) {
int d = xs[i] - xs[i - 1];
if (d > 0 && mind > d) mind = d;
}
printf("%d\n", mind < INF ? mind : 0);
return 0;
}
tnakao0123