結果

問題 No.716 距離
ユーザー snrnsidy
提出日時 2021-07-15 16:17:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 1,913 ms
コンパイル使用メモリ 193,796 KB
最終ジャッジ日時 2025-01-23 01:07:53
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N,t;
	vector <int> a;
	
	cin >> N;
	
	for(int i=0;i<N;i++)
	{
		cin >> t;
		a.push_back(t);
	}
	
	int MIN = 1e9;
	int MAX = a[N-1] - a[0];
	
	for(int i=1;i<N;i++)
	{
		MIN = min(MIN,a[i] - a[i-1]);
	}
	
	cout << MIN << '\n';
	cout << MAX << '\n';
	return 0;
}
0