結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー aaaaaaaaaa2230
提出日時 2024-02-23 22:34:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 252 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 3,210 ms
コンパイル使用メモリ 274,896 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-20 02:04:11
合計ジャッジ時間 8,146 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<long long> A(n);
    for (auto& a: A) cin >> a;

    long long l = 0;

    for (int i = 0; i < n-1; i++){
        long long a1 = A[i], a2 = A[i+1];
        
        if (a1 < a2) continue;

        long long dif = a1-a2 + 1;
        l = max(l,dif);

    }
    cout << l << endl;
}
int main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; i++){
        solve();
    }
    return 0;
}
0