結果

問題 No.135 とりあえず1次元の問題
ユーザー gotutiyan
提出日時 2017-10-21 00:10:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 992 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 87,680 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 10:54:01
合計ジャッジ時間 1,693 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define repp(i,j,k) for(int i=j;i>=k;i--)
#define llrep(i,j,k) for(long long int i=j;i<(long long int)k;i++)
#define Sort(x) sort(x.begin(),x.end()); 
#define vi vector<int>
#define vvi vector<vector<int>> 
#define ll long long
int mod=1e9+7;
const int INF = 100000000;

using namespace std;

void p(int x) {
	cout << x << endl;
}

void pp(string s) {
	cout << s << endl;
}




int main(void) {
	int n;
	cin >> n;
	int minn = INF;
	bool judge = true;
	vector<int> v(n);
	rep(i, 0, n)scanf("%d", &v[i]);
	Sort(v);
	rep(i, 0, n-1) {
		
		if (v[i + 1] - v[i] != 0 && minn > v[i + 1] - v[i]) {
			minn = v[i + 1] - v[i];
			judge = false;
		}
	}
	
	if (judge)cout << 0 << endl; else
	cout << minn << endl;
	return 0;
}
0