| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1342257 | SpyrosAliv | Bitaro the Brave 3 (JOI25_brave3) | C++20 | 2095 ms | 432 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, l, t, q;
vector<pair<int, pair<int, int>>> monst;
priority_queue<pair<int, int>> pq;
void do_ops(int ops) {
while (!pq.empty()) {
pair<int, int> curr = pq.top();
pq.pop();
int lastH = curr.second;
if (lastH > ops) {
curr.second -= ops;
ops = 0;
pq.push(curr);
return;
}
else if (lastH == ops) {
return;
}
else if (lastH < ops) {
ops -= lastH;
continue;
}
}
}
int get_pen(int diff) {
int currT = 0;
while (!pq.empty()) pq.pop();
int ops = 0;
for (auto [nextT, nxt]: monst) {
nxt.second *= diff;
if (nextT <= currT) {
pq.push({nxt});
continue;
}
ops = nextT - currT;
do_ops(ops);
currT = nextT;
pq.push({nxt});
}
ops = t - currT;
do_ops(ops);
int tot = 0;
while (!pq.empty()) {
tot += pq.top().first * pq.top().second;
pq.pop();
}
return tot;
}
void solve() {
cin >> n >> l >> t;
for (int i = 0; i < n; i++) {
int s, h, p; cin >> s >> h >> p;
monst.push_back({s, {p, h}});
}
sort(monst.begin(), monst.end());
cin >> q;
int currL = 0;
while (q--) {
int m; cin >> m;
if (currL == l) {
cout << currL << "\n";
continue;
}
while (get_pen(currL + 1) <= m) currL++;
cout << currL << "\n";
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
