結果
問題 |
No.716 距離
|
ユーザー |
|
提出日時 | 2018-09-20 23:29:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,907 bytes |
コンパイル時間 | 896 ms |
コンパイル使用メモリ | 115,556 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 08:37:10 |
合計ジャッジ時間 | 1,826 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #include <cstring> /* PascalCase クラス名 camelCase メソッド名,関数名,変数名 snake_case ファイル名,名前空間,std のメソッド名,変数名,型名に準じる場合 SNAKE_CASE マクロ名,static const 定数,列挙体 */ #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, init, n) for(int i = init; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend() #define Cout(obj) cout << obj << endl #define Size(obj) (int)(obj).size() #define fcout cout << fixed << setprecision(10) #define fi first #define se second using namespace std; using ll = long long int; const int MOD = 1e9 + 7; const int iINF = 1e9; const long long int llINF = 1e18; const double PI = acos(-1.0); const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<int> a(N); REP(i, N) { cin >> a[i]; } int min_ans = iINF, max_ans = -iINF; REP(i, N) { REP(j, N) { if(i == j) continue; min_ans = min(min_ans, abs(a[i] - a[j])); max_ans = max(max_ans, abs(a[i] - a[j])); } } Cout(min_ans); Cout(max_ans); return 0; }