結果

問題 No.716 距離
ユーザー tokutaro
提出日時 2020-03-21 09:28:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 69,868 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-17 22:29:27
合計ジャッジ時間 2,015 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> vc;
    REP(i, N) {
        int a;
        cin >> a;
        vc.push_back(a);
    }
    int max = vc.at(N - 1) - vc.at(0);
    int min = max;
    REP(i, N - 1) {
        int tmp = vc.at(i + 1) - vc.at(i);
        if (tmp < min) min = tmp;
    }
    cout << min << endl;
    cout << max << endl;
    return 0;
}
0