# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
525595 | inwbear | Village (BOI20_village) | C++14 | 173 ms | 37060 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;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
int n,a,b,h[100005],par[100005][18],wi[100005][18],ans1,Nnum[100005],rr,k,hf,dp[100005],cc,a1[100005],a2[100005];
LL ans2,ans3;
vector<int>v[100005],o;
int dfs(int N,int pr){
bool p=true;
vector<int>mat,nonmat;
dp[N]=1;
Nnum[rr]=N;
rr++;
h[N]=h[pr]+1;
wi[N][0]=1;
par[N][0]=pr;
for(int i=0;i<v[N].size();i++){
if(v[N][i]!=pr){
if(dfs(v[N][i],N)==1)nonmat.pb(v[N][i]);
dp[N]+=dp[v[N][i]];
if(dp[v[N][i]]>hf)p=false;
}
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... |