# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997942 | Trisanu_Das | Train (APIO24_train) | C++17 | 297 ms | 93132 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
const long long INF = 1'000'000'000'000'000;
const ll INF32 = 1'000'000'001;
void upd(ll w, vector<long long>& all, ll c, ll nw, vector<pair<ll, ll>>& eat) {
for (ll i = 0; i < (1 << w); i++) {
bool b = false;
for (ll j = 0; j < w; j++) {
if (!((i >> j) & 1)) {
if (eat[j].first <= nw) all[i + (1 << j)] = min(all[i] + c, all[i + (1 << j)]);
if (eat[j].second < nw) b = true;
}
}
if (b) all[i] = INF;
}
}
struct BIT {
vector<ll> tree;
vector<ll> all;
BIT(vector<ll> a) {
all = a;
all.push_back(-1);
all.push_back(INF32);
sort(all.begin(), all.end());
tree.resize(all.size() + 1);
}
Compilation message (stderr)
# | 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... |