結果

問題 No.135 とりあえず1次元の問題
ユーザー newlife171128newlife171128
提出日時 2018-03-06 23:42:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 896 bytes
コンパイル時間 3,296 ms
コンパイル使用メモリ 164,932 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 01:31:04
合計ジャッジ時間 4,496 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 34 ms
4,348 KB
testcase_22 AC 35 ms
4,348 KB
evil01.txt AC 32 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include "bits/stdc++.h"
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <unordered_map>
#include <string.h>
#include <utility>

typedef long long ll;
const int INF = 1e8;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;

typedef pair<int, int> P;

vector<int> points;

int main() {

	int n=0;
	cin>>n;

	int tmp=0;
	for(int i=0; i<n; i++){
		cin>>tmp;
		points.push_back(tmp);
	}

	sort(points.begin(),points.end());

	points.erase(unique(points.begin(),points.end()),points.end());


	if(points.size() ==1){
		cout<<0<<endl;
		return 0;
	}
	int ans =INF;
	for(int i=0; i<points.size()-1; i++){
		ans = min(ans,points[i+1]-points[i]);
	}

	cout<<ans<<endl;




return 0;

}

0