Submission #848394

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8483942023-09-12 12:18:25BidoTeimaCat in a tree (BOI17_catinatree)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e3 + 3;
vector<int>adj[N];
bool marked[N];
int sub[N],D;
int lol=0,sz;
int dfs_subtree(int node, int prev, int mxD){
sub[node] = 1;
for(int child : adj[node]){
if(child != prev && !marked[child]){
sub[node] += dfs_subtree(child, node,mxD+1);
}
}
return sub[node];
}
int find_centroid(int node, int prev){
for(int child : adj[node]){
if(child != prev && !marked[child] && 2 * sub[child] > sz){
return find_centroid(child, node);
}
}
return node;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...