# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1031572 | sleepntsheep | Triumphal arch (POI13_luk) | C11 | 45 ms | 9332 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<stdio.h>
#include<stdlib.h>
#define N 300000
void pus_(int **eh, int *eo, int x) {
int o = eo[0]++;
if (0 == o) eh[0] = (int*)malloc(2 * sizeof **eh);
else if (0 == (o & (o - 1))) eh[0] = (int*)realloc(eh[0], 2 * o * sizeof **eh) ;
eh[0][o] = x;
}
#define pus(a,b,c) pus_(&(a), &(b), c)
int n, ans, *adj[N], deg[N], vis[N];
int main(){
scanf("%d", &n);
for (int i = 1, u, v; i < n; ++i)
scanf("%d%d", &u, &v), pus(adj[u], deg[u], v), pus(adj[v], deg[v], u);
int hd = 0, tl = 0, *qu = NULL;
pus(qu, hd, 0);
vis[0]++;
while (hd - tl) {
int u = qu[tl++], juv = 0;
for (int j = 0; j < deg[u]; ++j) {
if (!vis[adj[u][j]]++) {
++juv;
pus(qu, hd, adj[u][j]);
}
}
if (juv > ans)
ans = juv;
}
printf("%d", ans);
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |