結果
問題 | No.2015 Stair Counter |
ユーザー |
![]() |
提出日時 | 2025-04-15 20:58:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 70 ms / 2,000 ms |
コード長 | 511 bytes |
コンパイル時間 | 4,152 ms |
コンパイル使用メモリ | 194,104 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-15 21:01:46 |
合計ジャッジ時間 | 6,898 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) int main() { int t; cin >> t; rep(i, t) { int n, m; cin >> n >> m; vector<int> v(n+2, 0); v[0] = 0; v[1] = m; bool ans = true; rep(j, n) { int a; cin >> a; int k = j + 2; if (v[k-2] <= a) { v[k-1] -= a - v[k-2]; v[k] = a; } else { ans = false; } } if (ans) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }