# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065052 | belgianbot | Regions (IOI09_regions) | C++17 | 2925 ms | 45828 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;
int cnt = 0, N, SQRT, R;
vector<int> a, in, out, occ;
vector<vector<int>> child;
map<int, vector<ll>> col;
map<int,int> curr;
vector<vector<pair<int,int>>> pref;
void dfs(int x) {
int last = 0;
if (!pref[a[x]].empty()) last = pref[a[x]].back().second;
pref[a[x]].push_back({cnt, last + 1});
in[x] = cnt++;
if (occ[a[x]] > SQRT) curr[a[x]]++;
for (int y : child[x]) {
dfs(y);
}
if (occ[a[x]] > SQRT) curr[a[x]] --;
for (auto z : curr) col[z.first][a[x]] += z.second;
out[x] = cnt;
}
signed main() {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |