Submission #1031572

#TimeUsernameProblemLanguageResultExecution timeMemory
1031572sleepntsheepTriumphal arch (POI13_luk)C11
0 / 100
45 ms9332 KiB
#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)

luk.c: In function 'main':
luk.c:16:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
luk.c:18:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%d%d", &u, &v), pus(adj[u], deg[u], v), pus(adj[v], deg[v], u);
      |         ^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...