結果
問題 |
No.2015 Stair Counter
|
ユーザー |
|
提出日時 | 2022-12-23 19:42:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 831 bytes |
コンパイル時間 | 566 ms |
コンパイル使用メモリ | 67,272 KB |
最終ジャッジ日時 | 2025-02-09 19:11:50 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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]); } if (b[n + 1]) { f = false; } cout << (f ? "Yes" : "No") << endl; } }