# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770166 | PurpleCrayon | Constellation 3 (JOI20_constellation3) | C++17 | 1586 ms | 28352 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 <bits/stdc++.h>
using namespace std;
#define sz(v) int(v.size())
#define ar array
typedef long long ll;
const int N = 2e5+10, MOD = 998244353;
int n, m, a[N], bro[N];
int par[N];
vector<int> child[N];
vector<pair<int, ll>> can[N];
ll dp[N];
void build_tree() {
memset(par, -1, sizeof(par));
vector<int> st;
for (int i = 0; i < n; i++) {
int last = -1;
while (sz(st) && a[st.back()] < a[i]) {
last = st.back();
st.pop_back();
}
if (sz(st)) par[i] = st.back();
if (last != -1) par[last] = i;
st.push_back(i);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |