結果
| 問題 | No.2922 Rose Garden |
| コンテスト | |
| ユーザー |
Jikky1618
|
| 提出日時 | 2024-10-12 20:35:30 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,243 bytes |
| 記録 | |
| コンパイル時間 | 3,742 ms |
| コンパイル使用メモリ | 255,788 KB |
| 実行使用メモリ | 19,024 KB |
| 最終ジャッジ日時 | 2024-10-12 20:35:37 |
| 合計ジャッジ時間 | 6,325 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
template <class T, class U>
T ceil(T x, U y) {
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <class T, class U>
T floor(T x, U y) {
return (x > 0 ? x / y : (x - y + 1) / y);
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
ll N, S, B;
cin >> N >> S >> B;
vector<ll> H(N);
for (int i = 0; i < N; i++) cin >> H[i];
// {id, stamina, height}
queue<tuple<int, ll, ll>> que;
que.emplace(0, S, H[0]);
for (int i = 0; i < 3 * N && !que.empty(); i++) {
auto [id, s, h] = que.front();
if (id == N - 1) {
cout << "Yes" << '\n';
return 0;
}
que.pop();
// そのまま上昇して, 次の足場に移動
if (h + s * B >= H[id + 1]) {
que.emplace(id + 1, s - ceil(H[id + 1] - h, B), h + ceil(H[id + 1] - h, B) * B);
}
// 一度地面につく
que.emplace(id, S, H[id]);
}
cout << "No" << '\n';
}
Jikky1618