結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2024-02-23 22:34:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 2,486 ms
コンパイル使用メモリ 245,916 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-29 07:34:58
合計ジャッジ時間 6,940 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

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