結果

問題 No.2015 Stair Counter
ユーザー みここ
提出日時 2022-12-23 19:50:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 68,000 KB
最終ジャッジ日時 2025-02-09 19:11:58
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        cin >> n >> m;
        int a[200005];
        a[0] = m;
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
        }
        a[n + 1] = 0;
        bool f = true;
        for (int i = 0; i < n; i++)
        {
            if (a[i + 1] - (m - a[i]) > a[i] || a[i] + a[i + 1] < m)
            {
                f = false;
            }
        }
        cout << (f ? "Yes" : "No") << endl;
    }
}
0