結果

問題 No.716 距離
ユーザー LV3zJigVW57oPGy
提出日時 2022-11-12 11:06:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 1,925 ms
コンパイル使用メモリ 166,376 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 03:06:41
合計ジャッジ時間 2,892 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std;
#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string>
#include <algorithm>

int main(){
  int a;
  cin >> a;
  vector<int> vec(a);
  for(int i=0;i<a;i++){
    cin >> vec.at(i);
  }
  sort(vec.rbegin(),vec.rend());
  int b = vec.at(0);
  int c = vec.at(1);
  sort(vec.begin(),vec.end());
  int d = vec.at(0);
  int e = vec.at(1);
  if(fabs(b-c)<fabs(d-e)){
    cout << fabs(b-c) << endl;
  }
  else{
    cout << fabs(d-e) << endl;
  }
  cout << fabs(b-d); 
}
0