# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973969 | phoenix | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 345 ms | 195644 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;
using ll = long long;
const int N = 200200;
int n;
int p[N];
int h[N];
int c[N];
map<int, ll> mp[N];
vector<int> g[N];
// u <- v
void join(int u, int v) {
if ((int)mp[u].size() < (int)mp[v].size()) swap(mp[u], mp[v]);
for (auto c : mp[v])
mp[u][c.first] += c.second;
};
bool vis[N];
void dfs(int v) {
vis[v] = true;
for (int to : g[v]) {
dfs(to);
join(v, to);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |