# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1095383 | hahahoang132 | Cat Exercise (JOI23_ho_t4) | C++17 | 89 ms | 45728 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>
#define ll long long
using namespace std;
#define bit(x,y) ((x >> y) & 1LL)
const ll mod = 1e9 + 7;
const ll N = 1e6 + 5;
const ll inf = LLONG_MAX/4;
ll p[N],h[N],ans[N],tmp[N];
vector<ll> a[N];
ll fp(ll x)
{
if(p[x] == -1) return x;
else
{
p[x] = fp(p[x]);
return p[x];
}
}
void hop(ll x, ll y)
{
ll px = x;
ll py = fp(y);
ans[px] = max(ans[px],ans[py] + abs(h[px] - h[py]));
p[py] = px;
}
void build(ll x, ll px)
{
for(auto y : a[x])
{
if(y != px)
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |