結果

問題 No.716 距離
ユーザー 🍮かんプリン
提出日時 2019-02-19 17:41:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 1,269 ms
コンパイル使用メモリ 158,456 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 10:47:06
合計ジャッジ時間 2,539 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int a[1000];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,s=1000000;
    cin >> n;
    rep(i,n) {
        cin >> a[i];
        if (i>=1) s=a[i]-a[i-1]<s?a[i]-a[i-1]:s;
    }
    cout << s << endl;
    cout << a[n-1]-a[0] << endl;
    return 0;
}
0