| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1342256 | SpyrosAliv | Bitaro the Brave 3 (JOI25_brave3) | C++20 | 2092 ms | 1616 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;
while (q--) {
int m; cin >> m;
int lo = 1, hi = l;
int ans = 0;
while (lo <= hi) {
int mid = (lo + hi) / 2;
int tot = get_pen(mid);
if (tot <= m) {
lo = mid+1;
ans = mid;
}
else {
hi = mid-1;
}
}
cout << ans << "\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... | ||||
