結果

問題 No.2015 Stair Counter
ユーザー taisii2
提出日時 2022-07-22 21:38:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 1,612 ms
コンパイル使用メモリ 169,788 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 05:41:18
合計ジャッジ時間 3,651 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
      cin >> A[i];
    }
    vector<int> B(N - 1);
    for (int i = 0; i < N - 1; i++) {
      B[i] = A[i] + A[i + 1];
    }
    bool ok = true;
    for (int i = 0; i < N - 1; i++) {
      if (B[i] < M) {
        ok = false;
      }
    }
    if (ok) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
0