結果
| 問題 | No.3459 Defeat Slimes |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-28 15:20:51 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,191 bytes |
| 記録 | |
| コンパイル時間 | 4,014 ms |
| コンパイル使用メモリ | 350,860 KB |
| 実行使用メモリ | 25,148 KB |
| 最終ジャッジ日時 | 2026-02-28 15:21:42 |
| 合計ジャッジ時間 | 19,921 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 4 RE * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
struct s {
ll c, l, x;
};
int main() {
ll n, y, z;
cin >> n >> y >> z;
vector<s> v(n);
for (auto &[c, l, x] : v)
cin >> c >> l >> x;
v.push_back({0LL, 1LL << 60, 0LL});
sort(v.begin(), v.end(), [&](s a, s b) {
return a.l < b.l;
});
priority_queue<pair<ll, ll>> q;
int ind = 0;
ll ans = 0;
while (v[ind].l <= y) {
q.push({v[ind].x, v[ind].c});
ind++;
}
while (v[ind].l <= y || !q.empty()) {
while (v[ind].l <= y) {
q.push({v[ind].x, v[ind].c});
ind++;
}
if ((z <= v[ind].l) && y + __int128(q.top().first) * q.top().second >= z) {
cout << ans + (z - y - 1) / (q.top().first) + 1 << endl;
return 0;
}
auto p = q.top();
q.pop();
ll r = (v[ind].l - y - 1) / (p.first) + 1;
ans += min(r, p.second);
y += min(r, p.second) * p.first;
p.second -= min(r, p.second);
if (p.second != 0)
q.push(p);
}
cout << -1 << endl;
return 0;
}