結果

問題 No.716 距離
ユーザー OhnotOhnot
提出日時 2018-09-04 09:36:23
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 161,616 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 19:30:22
合計ジャッジ時間 2,505 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

#define print(x) std::cout << x << std::endl

using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

  int N; cin >> N;
	VI a(N,0);

	REP(i,N) cin >> a[i];

	VI d(N-1,0);
	REP(i,N-1) d[i] = a[i+1] - a[i];
	sort(d.begin(),d.end());
	print(d.front());
	print(a[N-1]-a[0]);


	return 0;

}
0