結果

問題 No.716 距離
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-07-21 17:32:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 102,876 KB
実行使用メモリ 8,992 KB
最終ジャッジ日時 2023-08-28 18:16:09
合計ジャッジ時間 3,545 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
7,464 KB
testcase_01 AC 73 ms
7,644 KB
testcase_02 AC 73 ms
8,024 KB
testcase_03 AC 73 ms
7,372 KB
testcase_04 AC 73 ms
7,604 KB
testcase_05 AC 72 ms
7,676 KB
testcase_06 AC 73 ms
8,276 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 51 ms
8,468 KB
testcase_11 AC 14 ms
4,376 KB
testcase_12 AC 67 ms
8,968 KB
testcase_13 AC 46 ms
8,436 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 60 ms
8,584 KB
testcase_16 AC 25 ms
5,380 KB
testcase_17 AC 64 ms
7,640 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 17 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 8 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 51 ms
8,992 KB
testcase_25 AC 15 ms
4,376 KB
testcase_26 AC 29 ms
5,248 KB
testcase_27 AC 38 ms
5,188 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 31 ms
5,240 KB
testcase_30 AC 30 ms
5,240 KB
testcase_31 AC 46 ms
8,524 KB
testcase_32 AC 36 ms
5,244 KB
testcase_33 AC 33 ms
5,032 KB
testcase_34 AC 23 ms
5,032 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 5 ms
4,376 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 12 ms
4,376 KB
testcase_39 AC 32 ms
5,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;

const int inf = (int)1e9; 

ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}


int main(void){
	int n;
	cin>>n;
	vector<int>a(n),seq;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)continue;
			seq.push_back((ll)abs(a[i]-a[j]));
		}
	}
	sort(seq.begin(),seq.end());
	cout<<seq[0]<<endl;
	cout<<seq[seq.size()-1]<<endl;
	return 0;
}
0