結果
問題 | No.2015 Stair Counter |
ユーザー |
![]() |
提出日時 | 2022-07-22 21:28:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 736 bytes |
コンパイル時間 | 2,504 ms |
コンパイル使用メモリ | 195,392 KB |
最終ジャッジ日時 | 2025-01-30 12:01:45 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define ll long longint main() {ios::sync_with_stdio(0);cin.tie(0);int T;cin >> T;for (int i=0;i<T;i++) {int n;ll m;cin >> n >> m;vector<ll> A(n);for (int j=0;j<n;j++) cin >> A[j];bool ans = true;ll num0 = m;ll num1 = 0LL;for (int j=0;j<n;j++) {ll diff = A[j]-num1;if (diff < 0) ans = false;num0 -= diff;if (num0 < 0) ans = false;ll tmp = num0;num0 = A[j];num1 = tmp;}if (ans) cout << "Yes" << "\n";else cout << "No" << "\n";}return 0;}