結果
| 問題 |
No.2015 Stair Counter
|
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-09-21 17:17:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 69 ms / 2,000 ms |
| コード長 | 802 bytes |
| コンパイル時間 | 1,927 ms |
| コンパイル使用メモリ | 194,952 KB |
| 最終ジャッジ日時 | 2025-02-16 23:53:56 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 25 |
ソースコード
#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;
}
}
kpinkcat