# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197036 | dennisstar | Ideal city (IOI12_city) | C++11 | 94 ms | 10060 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 fi first
#define se second
#define ryan bear
#define sq(X) ((X)*(X))
#define eb emplace_back
#define all(V) (V).begin(), (V).end()
#define unq(V) (V).erase(unique(all(V)), (V).end())
using namespace std;
typedef long long ll;
typedef vector<ll> vlm;
typedef vector<int> vim;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const ll MOD=1000000000ll;
int N; vector<pii> P;
inline int Find(pii p) {
int lb=lower_bound(all(P), p)-P.begin();
return (lb<P.size()&&P[lb]==p)?lb:-1;
}
vim adj[100010]; int ar[100010], sz[100010], vis[100010]; ll D[100010];
//d1 : 부분트리의 크기, d2 : 부분트리에서의 값
ll ans=0;
void dfs1(int now) {
vis[now]=1; D[now]=sz[now];
for (int i:adj[now]) if (!vis[i]) {
dfs1(i);
D[now]+=D[i];
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... |