# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170847 | 2019-12-26T14:36:41 Z | juggernaut | Shymbulak (IZhO14_shymbulak) | C++14 | 1500 ms | 10352 KB |
//Just try and the idea will come! #include<bits/stdc++.h> #define int long long int using namespace std; int mx,cnt,n,x,y,i; bool vis[200001]; vector<vector<int>>g(200001); void dfs(int v,int cost){ vis[v]=1; if(cost>mx){ mx=cost; cnt=1; }else if(cost==mx)cnt++; for(int to:g[v]) if(!vis[to])dfs(to,cost+1); vis[v]=0; } main(){ scanf("%lld",&n); for(i=0;i<n;i++){ scanf("%lld%lld",&x,&y); g[x].push_back(y); g[y].push_back(x); } for(i=0;i<n;i++)dfs(i+1,0); printf("%lld",cnt>>1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 4984 KB | Output is correct |
2 | Incorrect | 6 ms | 4984 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 5240 KB | Output is correct |
2 | Incorrect | 12 ms | 5112 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1554 ms | 10352 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |