結果

問題 No.2648 [Cherry 6th Tune D] 一次元の馬
コンテスト
ユーザー Nzt3
提出日時 2024-02-24 18:30:07
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 19 ms / 2,000 ms
+ 134µs
コード長 421 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,443 ms
コンパイル使用メモリ 212,320 KB
実行使用メモリ 9,408 KB
最終ジャッジ日時 2026-07-12 10:12:03
合計ジャッジ時間 3,777 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
void solve();
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int test_case;
  cin>>test_case;
  while (test_case--){
    solve();
  }
}
void solve(){
  int N;
  cin>>N;
  vector A(N,0);
  for(int &i:A)cin>>i;
  int ans=0;
  for(int i=0;i<N-1;i++){
    ans=max(ans,A[i]-A[i+1]+1);
  }
  cout<<ans<<'\n';
}
0