結果

問題 No.716 距離
ユーザー GB
提出日時 2018-09-20 21:45:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 76,476 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-18 08:36:48
合計ジャッジ時間 1,519 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	
	int n;
	vector<int> a;
	bool flag=false;

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

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

	for (int i = 0;i < a.size()-1;i++) {
		if (a[i] == a[i + 1])flag = true;
	}

	if (flag)cout << 0 << endl;
	else cout << abs(a[1] - a[0]) << endl;
	cout << abs(a[a.size() - 1] - a[0]) << endl;
	

	return 0;
}
0