# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
782866 | Sami_Massah | Subtree (INOI20_subtree) | C++17 | 751 ms | 1048576 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 long long maxn = 2e5 + 12, mod = 1e9 + 7;
long long n, m, pd[maxn], h[maxn], dp[maxn], sum[maxn];
vector <int> conn[maxn], nums;
bitset <maxn> marked, in_nums;
void dfs(int u, int p = -1){
marked[u] = 1;
int me = -1;
for(int v: conn[u])
if(!marked[v]){
pd[v] = u;
h[v] = h[u] + 1;
dfs(v, u);
}
else if(h[u] < h[v])
me = v;
// cout << u << ' ' << me << endl;
if(me == -1){
dp[u] = 1;
for(int v: conn[u])
if(h[u] < h[v]){
// cout << u << '-' << v << endl;
dp[u] = (dp[u] * (dp[v] + 1)) % mod;
}
dp[u] %= mod;
//cout << u << "->" << dp[u] << endl;
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... |