結果
| 問題 |
No.2015 Stair Counter
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-23 19:43:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 766 bytes |
| コンパイル時間 | 528 ms |
| コンパイル使用メモリ | 67,440 KB |
| 最終ジャッジ日時 | 2025-02-09 19:11:54 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 WA * 21 |
ソースコード
#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];
}
int b[200005];
b[0] = b[1] = 0;
bool f = true;
for (int i = 0; i < n; i++)
{
if (a[i + 1] - b[i + 1] > a[i])
{
f = false;
break;
}
if (i < n - 1 && a[i] - a[i + 1] - b[i + 1] > a[i + 2])
{
f = false;
break;
}
b[i + 2] = a[i] - (a[i + 1] - b[i + 1]);
}
cout << (f ? "Yes" : "No") << endl;
}
}