結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using mint = modint998244353;

void solve() {
  int N; cin >> N;
  vector<ll> A(N + 1);
  for (int i = 1; i <= N; i++) cin >> A[i];
  ll ans = 0;
  for (int i = 1; i <= N - 1; i++) {
    if (A[i] >= A[i + 1]) {
      ans = max(ans, A[i] - A[i + 1] + 1);
    } 
  }
  cout << ans << endl;
}

int main() {
  int T; cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
0