結果

問題 No.716 距離
ユーザー sorag
提出日時 2022-08-06 01:39:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 80,480 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 23:19:43
合計ジャッジ時間 1,933 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include<string>
#include<algorithm>
#include<math.h>
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    int n;
    int ma=0;
    int mi=0;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    mi=abs(a[0]-a[1]);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i!=j){
            ma=max(ma,abs(a[i]-a[j]));
            mi=min(mi,abs(a[i]-a[j]));
            }
        }
    }
    cout<<mi<<endl;
    cout<<ma<<endl;
    return 0;
}
     


0