# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
602945 | cadmiumsky | Newspapers (CEOI21_newspapers) | C++14 | 214 ms | 4572 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;
using tii = tuple<int,int,int>;
using pii = pair<int,int>;
const int inf = 1e6 + 5, nmax = 1e3 + 5;
vector<int> g[nmax], light[nmax];
int h[nmax], atrleaf[nmax], heavy[nmax];
int ondiam[nmax];
void chmax(tii &l, tii r) {
l = max(l, r);
}
tii finddiam(int node, int f) {
tii rez = {1, node, node};
atrleaf[node] = node;
h[node] = 1;
for(auto x : g[node]) {
if(x == f) continue;
chmax(rez, finddiam(x, node));
if(h[x] + 1 > h[node]) {
h[node] = h[x] + 1;
atrleaf[node] = atrleaf[x];
}
}
int other = 0, atr = node;
for(auto x : g[node]) {
if(x == f || atrleaf[node] == atrleaf[x])
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... |