# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1155093 | ace5 | Newspapers (CEOI21_newspapers) | C++20 | 38 ms | 4680 KiB |
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
bool cyc = 0;
vector<int> vis;
void dfs1(int v,int p)
{
vis[v] = 1;
for(auto u:g[v])
{
if(!vis[u])
dfs1(u,v);
else if(u != p)
cyc = 1;
}
return ;
}
pair<int,int> dfs2(int v,int p)
{
pair<int,int> ans ={v,0};
for(auto u:g[v])
{
if(u != p)
{
pair<int,int> ne = dfs2(u,v);
if(ne.second + 1 > ans.second)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |