結果

問題 No.716 距離
ユーザー troro_kelp
提出日時 2018-08-12 17:43:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 691 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 79,588 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 07:29:25
合計ジャッジ時間 2,374 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;

long long N, M;
int y, m, d;
string S, T;
void solve(){
    int mind=1111110, maxd=0, temp=0;
    for(int i=0; i<N; ++i){
        int a; cin >> a;
        if(i==0) maxd=a;
        if(i==N-1) maxd = a - maxd;
        if(i!=0){
        mind = min(mind, abs(a-temp));
        }
        temp = a;
    }
    
    cout << mind <<endl;
    cout << maxd << endl;
    
}
int main() {
    cin >> N;
    solve();
	return 0;
}
0