結果
問題 |
No.716 距離
|
ユーザー |
|
提出日時 | 2019-08-28 21:12:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 1,590 ms |
コンパイル使用メモリ | 167,436 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 16:33:19 |
合計ジャッジ時間 | 2,307 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
/** @file 716.cpp @title No.716 距離 - yukicoder @url https://yukicoder.me/problems/no/716 **/ #include <bits/stdc++.h> using namespace std; typedef long long LL; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, N) for (int i = 0; i < (N); ++i) int main() { int N; cin >> N; vector<LL> a(N, 0); REP(i, N) { cin >> a[i]; } LL min = 1e6; LL max = a[N - 1] - a[0]; for (int i = 1; i < N; i++) { min = min > abs(a[i] - a[i - 1]) ? abs(a[i] - a[i - 1]) : min; } cout << min << endl; cout << max << endl; return 0; }