結果
問題 | No.2922 Rose Garden |
ユーザー |
|
提出日時 | 2024-10-12 15:02:35 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 72 ms / 3,000 ms |
コード長 | 726 bytes |
コンパイル時間 | 744 ms |
コンパイル使用メモリ | 131,080 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 15:02:40 |
合計ジャッジ時間 | 4,106 ms |
ジャッジサーバーID (参考情報) |
judge / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <string> #include <utility> #include <tuple> #include <set> #include <map> #include <cassert> using namespace std; // 最大たかさにいく、高さ更新できるなら足場に移動して更新する int main() { int n; long long s, b; cin >> n >> s >> b; vector<long long> h(n, 0); for (int i = 0; i < n; i++) { cin >> h[i]; } bool ok = true; long long height = h[0]; for (int i = 0; i < n; i++) { // fprintf(stderr, "i %d, height %lld, h[i] %lld\n", i, height, h[i]); if (height < h[i]) { ok = false; break; } height = max(height, h[i] + b*s); } cout << (ok ? "Yes" : "No") << endl; return 0; }