結果

問題 No.2015 Stair Counter
ユーザー Nzt3
提出日時 2022-07-22 21:29:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 2,228 ms
コンパイル使用メモリ 194,284 KB
最終ジャッジ日時 2025-01-30 12:02:32
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin>>T;
  while(T--){
    int N,M;
    cin>>N>>M;
    vector<int>A(N);
    for(int &i:A)cin>>i;
    bool ok=true;
    array<int,2>K={0,M};
    for(int i=0;i<N;i++){
      if(A[i]<K[0])ok=false;
      int x=A[i]-K[0];
      K[0]=K[1]-x;
      K[1]=A[i];
    }
    cout<<(ok?"Yes\n":"No\n");
  }
}
0