Submission #1779279
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; int N; vector<int> G[100010]; pii DFS(int v,int p) { pii res = pii(0,v); for(int i = 0; i < G[v].size(); i++)if(G[v][i] != p) res = max(res,DFS(G[v][i],v)); return pii(res.first + 1,res.second); } int main() { scanf("%d",&N); for(int i = 0; i < N - 1; i++) { int a,b; scanf("%d%d",&a,&b); G[a].push_back(b); G[b].push_back(a); } pii MAX = DFS(1,0); MAX = DFS(MAX.second,0); int now = 1; for(int i = 0; i < N; i++) { if(MAX.first <= now) { printf("%d\n",i); return 0; } now = now * 2 + 1; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Uninity |
User | unit |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 780 Byte |
Status | WA |
Exec Time | 57 ms |
Memory | 15104 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:20:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.cpp:24:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d",&a,&b); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt, 52.txt, 53.txt, 54.txt, 55.txt, 56.txt, 57.txt, 58.txt, 59.txt, 60.txt, 61.txt, 62.txt, 63.txt, 64.txt, 65.txt, 66.txt, 67.txt, 68.txt, 69.txt, 70.txt, 71.txt, 72.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 46 ms | 5888 KB |
02.txt | WA | 56 ms | 5888 KB |
03.txt | WA | 53 ms | 5760 KB |
04.txt | WA | 47 ms | 5760 KB |
05.txt | WA | 53 ms | 5888 KB |
06.txt | WA | 47 ms | 5888 KB |
07.txt | WA | 50 ms | 5888 KB |
08.txt | WA | 45 ms | 5760 KB |
09.txt | AC | 35 ms | 10752 KB |
10.txt | AC | 36 ms | 10752 KB |
11.txt | AC | 18 ms | 6656 KB |
12.txt | AC | 18 ms | 6656 KB |
13.txt | AC | 56 ms | 15104 KB |
14.txt | AC | 51 ms | 13824 KB |
15.txt | AC | 53 ms | 11904 KB |
16.txt | WA | 53 ms | 10368 KB |
17.txt | AC | 31 ms | 6136 KB |
18.txt | AC | 31 ms | 6144 KB |
19.txt | WA | 34 ms | 6272 KB |
20.txt | WA | 35 ms | 6272 KB |
21.txt | WA | 36 ms | 6144 KB |
22.txt | WA | 37 ms | 6144 KB |
23.txt | AC | 34 ms | 6136 KB |
24.txt | AC | 33 ms | 6136 KB |
25.txt | AC | 39 ms | 6012 KB |
26.txt | AC | 53 ms | 6016 KB |
27.txt | AC | 49 ms | 6016 KB |
28.txt | AC | 50 ms | 6016 KB |
29.txt | AC | 51 ms | 6016 KB |
30.txt | AC | 53 ms | 6016 KB |
31.txt | AC | 55 ms | 6016 KB |
32.txt | AC | 44 ms | 5888 KB |
33.txt | WA | 46 ms | 5888 KB |
34.txt | AC | 49 ms | 5888 KB |
35.txt | WA | 45 ms | 5888 KB |
36.txt | WA | 46 ms | 5888 KB |
37.txt | WA | 46 ms | 5888 KB |
38.txt | WA | 46 ms | 5760 KB |
39.txt | WA | 46 ms | 5760 KB |
40.txt | WA | 45 ms | 5888 KB |
41.txt | WA | 44 ms | 5888 KB |
42.txt | WA | 47 ms | 5760 KB |
43.txt | WA | 47 ms | 5760 KB |
44.txt | WA | 38 ms | 6400 KB |
45.txt | WA | 38 ms | 6400 KB |
46.txt | WA | 40 ms | 6400 KB |
47.txt | WA | 40 ms | 6400 KB |
48.txt | WA | 46 ms | 6272 KB |
49.txt | WA | 43 ms | 6272 KB |
50.txt | WA | 47 ms | 6144 KB |
51.txt | WA | 45 ms | 6144 KB |
52.txt | WA | 47 ms | 6016 KB |
53.txt | WA | 47 ms | 6016 KB |
54.txt | WA | 48 ms | 6016 KB |
55.txt | WA | 47 ms | 6016 KB |
56.txt | AC | 39 ms | 6136 KB |
57.txt | AC | 44 ms | 10620 KB |
58.txt | AC | 53 ms | 10620 KB |
59.txt | AC | 57 ms | 6016 KB |
60.txt | AC | 53 ms | 6016 KB |
61.txt | AC | 36 ms | 7544 KB |
62.txt | AC | 36 ms | 7544 KB |
63.txt | AC | 3 ms | 2560 KB |
64.txt | AC | 3 ms | 2560 KB |
65.txt | WA | 3 ms | 2560 KB |
66.txt | AC | 3 ms | 2560 KB |
67.txt | AC | 3 ms | 2560 KB |
68.txt | WA | 3 ms | 2560 KB |
69.txt | AC | 3 ms | 2560 KB |
70.txt | AC | 3 ms | 2560 KB |
71.txt | AC | 3 ms | 2560 KB |
72.txt | AC | 3 ms | 2560 KB |
s1.txt | AC | 3 ms | 2560 KB |
s2.txt | AC | 3 ms | 2560 KB |