結果

問題 No.716 距離
ユーザー Enjapma_kyoproEnjapma_kyopro
提出日時 2018-08-23 20:11:18
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,574 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 84,564 KB
実行使用メモリ 12,168 KB
最終ジャッジ日時 2023-08-27 06:33:32
合計ジャッジ時間 2,816 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,876 KB
testcase_01 AC 5 ms
12,148 KB
testcase_02 AC 4 ms
11,824 KB
testcase_03 AC 4 ms
11,832 KB
testcase_04 AC 5 ms
11,820 KB
testcase_05 AC 4 ms
11,920 KB
testcase_06 AC 4 ms
11,920 KB
testcase_07 AC 4 ms
11,876 KB
testcase_08 AC 4 ms
11,856 KB
testcase_09 AC 4 ms
11,864 KB
testcase_10 AC 4 ms
11,888 KB
testcase_11 AC 4 ms
11,860 KB
testcase_12 AC 4 ms
11,868 KB
testcase_13 AC 4 ms
11,828 KB
testcase_14 AC 4 ms
11,876 KB
testcase_15 AC 5 ms
12,144 KB
testcase_16 AC 4 ms
12,084 KB
testcase_17 AC 5 ms
11,980 KB
testcase_18 AC 4 ms
11,824 KB
testcase_19 AC 4 ms
12,168 KB
testcase_20 AC 4 ms
11,868 KB
testcase_21 AC 4 ms
11,832 KB
testcase_22 AC 5 ms
11,872 KB
testcase_23 AC 4 ms
11,828 KB
testcase_24 AC 4 ms
11,880 KB
testcase_25 AC 4 ms
11,836 KB
testcase_26 AC 5 ms
11,876 KB
testcase_27 AC 4 ms
11,832 KB
testcase_28 AC 4 ms
11,920 KB
testcase_29 AC 4 ms
11,872 KB
testcase_30 AC 5 ms
11,828 KB
testcase_31 AC 5 ms
11,824 KB
testcase_32 AC 4 ms
12,160 KB
testcase_33 AC 5 ms
11,916 KB
testcase_34 AC 4 ms
11,920 KB
testcase_35 AC 5 ms
11,968 KB
testcase_36 AC 4 ms
11,820 KB
testcase_37 AC 4 ms
11,876 KB
testcase_38 AC 4 ms
11,872 KB
testcase_39 AC 5 ms
11,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
long long int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
 
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll>> pqls;
priority_queue <P,vector<P>,greater<P>> pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 
ll i,j,k,ii,jj;
ll n,m,num;
ll ans;
ll a,b,c,d,e,f,g,h,w;
 
ll x[800005],y[800005],z[900005];
char s[500005];
ll dp[100005][15];
ll sum[100005];

int main(){	
    cin>>n;
	for(i=0;i<n;i++){
		cin>>x[i];
	}
	ans = INF;
	for(i=0;i<n-1;i++){
		ans = min(ans,x[i+1]-x[i]);
	}
	p(ans);
	p(x[n-1]-x[0]);
	

	return 0;
}
0