結果

問題 No.2015 Stair Counter
ユーザー kpinkcatkpinkcat
提出日時 2023-09-21 17:17:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 200,340 KB
実行使用メモリ 4,616 KB
最終ジャッジ日時 2023-09-21 17:17:58
合計ジャッジ時間 4,198 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 36 ms
4,380 KB
testcase_02 AC 40 ms
4,380 KB
testcase_03 AC 43 ms
4,376 KB
testcase_04 AC 34 ms
4,376 KB
testcase_05 AC 32 ms
4,376 KB
testcase_06 AC 47 ms
4,376 KB
testcase_07 AC 47 ms
4,380 KB
testcase_08 AC 47 ms
4,380 KB
testcase_09 AC 24 ms
4,376 KB
testcase_10 AC 25 ms
4,376 KB
testcase_11 AC 28 ms
4,376 KB
testcase_12 AC 24 ms
4,380 KB
testcase_13 AC 25 ms
4,376 KB
testcase_14 AC 30 ms
4,376 KB
testcase_15 AC 34 ms
4,376 KB
testcase_16 AC 56 ms
4,380 KB
testcase_17 AC 24 ms
4,412 KB
testcase_18 AC 48 ms
4,380 KB
testcase_19 AC 60 ms
4,616 KB
testcase_20 AC 30 ms
4,568 KB
testcase_21 AC 34 ms
4,380 KB
testcase_22 AC 40 ms
4,376 KB
testcase_23 AC 44 ms
4,376 KB
testcase_24 AC 36 ms
4,376 KB
testcase_25 AC 35 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;

int main()
{
    ll t, n, m, tmp;
    cin >> t;
    bool no = false;
    for (int i = 0; i < t; i++){
        cin >> n >> m;
        vector<ll> a(n+1);
        a[0] = m;
        for (int j = 1; j <= n; j++){
            cin >> tmp;
            if (a[j] > tmp){
                no = true;
            }
            if (j != n){
                a[j+1] += (a[j - 1] + a[j] - tmp);
                a[j] = tmp;
            }
        }
        if (no) {
            cout << "No" << "\n";
            no = false;
        } else if (a[n-1] + a[n] == m) cout << "Yes" << endl;
    }
}
0