# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
625291 | chonka | Network (BOI15_net) | C++17 | 632 ms | 60268 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 ;
typedef long long ll ;
typedef unsigned long long ull ;
#define fi first
#define se second
// mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const int MAXN = 5e5 + 7 ;
int n ;
vector < int > v[ MAXN ] , ord ;
int cnt[ MAXN ] , root , prv[ MAXN ] ;
int spec ;
void init ( int x , int lst ) {
bool leaf = true ;
cnt[ x ] = 0 ;
for ( auto y : v[ x ] ) {
if ( y == lst ) { continue ; }
leaf = false ;
prv[ y ] = x ;
init ( y , x ) ;
cnt[ x ] += cnt[ y ] ;
}
if ( leaf == true ) {
++ cnt[ x ] ;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |