# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484448 | apostoldaniel854 | Ideal city (IOI12_city) | C++14 | 92 ms | 14648 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;
const int MOD = 1e9;
const int MAX_N = 1e5;
using ll = long long;
set <int> gr[1 + MAX_N];
int sz[1 + MAX_N];
void clean(int n) {
for (int i = 1; i <= n; i++)
gr[i].clear(), sz[i] = 0;
}
void dfs_cnt(int node, int par, int &ans, int total_sz) {
for (int son : gr[node])
if (son != par) {
dfs_cnt(son, node, ans, total_sz);
sz[node] += sz[son];
}
ans += 1ll * sz[node] * (total_sz - sz[node]) % MOD;
ans %= MOD;
}
int solve(vector <pair <pair <int, int>, int>> v) {
int n = v.size();
sort(v.begin(), v.end());
int tag = 0;
for (int i = 0; i < n; 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |