結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー eve__fuyuki
提出日時 2024-02-25 15:42:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 193,684 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 02:04:46
合計ジャッジ時間 4,540 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

int main() {
    fast_io();
    int t;
    cin >> t;
    for (; t--;) {
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        long long ans = 0;
        for (int i = 0; i < n - 1; i++) {
            ans = max(ans, a[i] - a[i + 1] + 1);
        }
        cout << ans << "\n";
    }
}
0