結果

問題 No.2015 Stair Counter
ユーザー mmn15277198
提出日時 2022-07-25 20:23:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 167,700 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 22:49:48
合計ジャッジ時間 3,751 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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];
    }
    bool ok = true;
    for (int i = 0; i < n - 1; i++) {
      if (m <= a[i] + a[i + 1] && a[i] + a[i + 1] <= 2 * m) continue;
      ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
  }
  return 0;
}
0