제출 #1031571

#제출 시각아이디문제언어결과실행 시간메모리
1031571sleepntsheep새로운 문제 (POI13_luk)C11
0 / 100
60 ms13396 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, 1); vis[1]++; 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); }

컴파일 시 표준 에러 (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...