結果

問題 No.135 とりあえず1次元の問題
コンテスト
ユーザー Heart_Blue
提出日時 2025-12-19 19:50:45
言語 C++23
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 989 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,742 ms
コンパイル使用メモリ 163,312 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-19 19:50:49
合計ジャッジ時間 3,520 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <string>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <iomanip>
#include <ctime>
#include <valarray>
#include <iostream>
#include <sstream>
#include <fstream>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	vector<int> v(n);
	for (auto& x : v) cin >> x;
	sort(v.begin(), v.end());
	v.resize(unique(v.begin(), v.end()) - v.begin());
	int ans = INF;
	for (int i = 1; i < v.size(); i++)
		ans = min(ans, v[i] - v[i - 1]);
	if (ans == INF) ans = 0;
	cout << ans << endl;
	return 0;
}
0