Submission #1077188
Source Code Expand
#include <stdio.h> #include <string.h> #define M(a,b)((a)>(b)?(a):(b)) typedef struct{int x,y;}pii; int i,j,n,k,a,b,d[1001][1001]; pii w(){ scanf("%d%d",&n,&k); memset(d,11,sizeof(d)); for(i=0;i<n;i++)d[i][i]=0; for(;k;k--)scanf("%d%d",&a,&b),d[a][b]=1,d[b][a]=1; for(k=0;k<n;k++)for(i=0;i<n;i++)for(j=0;j<n;j++)if(d[i][j]>(a=d[i][k]+d[k][j]))d[i][j]=a; int mi=1<<30,ma=0,m; for(i=0;i<n;i++){ m=0; for(j=0;j<n;j++)if(m<d[i][j])m=d[i][j]; if(mi>m)mi=m; if(ma<m)ma=m; } pii p={mi,ma};return p; } int main(){ pii p=w(),q=w(); i=!printf("%d %d\n",M(p.x+q.x+1,M(p.y,q.y)),p.y+q.y+1); }
Submission Info
Submission Time | |
---|---|
Task | C - 直径 |
User | leafmoon |
Language | C++11 (GCC 4.8.1) |
Score | 100 |
Code Size | 622 Byte |
Status | AC |
Exec Time | 1664 ms |
Memory | 4640 KB |
Compile Error
./Main.cpp: In function ‘pii w()’: ./Main.cpp:7:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d",&n,&k); ^ ./Main.cpp:10:52: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for(;k;k--)scanf("%d%d",&a,&b),d[a][b]=1,d[b][a]=1; ^
Judge Result
Set Name | Small | Large | ||||
---|---|---|---|---|---|---|
Score / Max Score | 50 / 50 | 50 / 50 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Small | 10-small_random-00, 10-small_random-01, 10-small_random-02, 10-small_random-03, 10-small_random-04, 10-small_random-05, 10-small_random-06, 10-small_random-07, 10-small_random-08, 10-small_random-09, 10-small_random-10, 10-small_random-11, 10-small_random-12, 10-small_random-13, 10-small_random-14, 10-small_random-15, 10-small_random-16, 10-small_random-17, 10-small_random-18, 10-small_random-19, 21-small_path-00, 21-small_path-01, 21-small_path-02, 21-small_path-03, 21-small_path-04, 00-sample-00, 00-sample-01, 00-sample-02 |
Large | 00-sample-00, 00-sample-01, 00-sample-02, 10-small_random-00, 10-small_random-01, 10-small_random-02, 10-small_random-03, 10-small_random-04, 10-small_random-05, 10-small_random-06, 10-small_random-07, 10-small_random-08, 10-small_random-09, 10-small_random-10, 10-small_random-11, 10-small_random-12, 10-small_random-13, 10-small_random-14, 10-small_random-15, 10-small_random-16, 10-small_random-17, 10-small_random-18, 10-small_random-19, 20-small_tree-00, 20-small_tree-01, 20-small_tree-02, 20-small_tree-03, 20-small_tree-04, 21-small_path-00, 21-small_path-01, 21-small_path-02, 21-small_path-03, 21-small_path-04, 30-large_random-00, 30-large_random-01, 30-large_random-02, 30-large_random-03, 30-large_random-04, 30-large_random-05, 30-large_random-06, 30-large_random-07, 30-large_random-08, 30-large_random-09, 40-large_comp-00, 40-large_comp-01, 40-large_comp-02, 40-large_comp-03, 40-large_comp-04, 41-large_tree-00, 41-large_tree-01, 41-large_tree-02, 41-large_tree-03, 41-large_tree-04, 42-large_path-00, 42-large_path-01, 42-large_path-02, 42-large_path-03, 42-large_path-04 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00-sample-00 | AC | 21 ms | 4640 KB |
00-sample-01 | AC | 22 ms | 4524 KB |
00-sample-02 | AC | 22 ms | 4640 KB |
10-small_random-00 | AC | 21 ms | 4636 KB |
10-small_random-01 | AC | 21 ms | 4632 KB |
10-small_random-02 | AC | 23 ms | 4640 KB |
10-small_random-03 | AC | 21 ms | 4508 KB |
10-small_random-04 | AC | 21 ms | 4636 KB |
10-small_random-05 | AC | 23 ms | 4640 KB |
10-small_random-06 | AC | 21 ms | 4632 KB |
10-small_random-07 | AC | 21 ms | 4640 KB |
10-small_random-08 | AC | 21 ms | 4512 KB |
10-small_random-09 | AC | 23 ms | 4636 KB |
10-small_random-10 | AC | 23 ms | 4640 KB |
10-small_random-11 | AC | 23 ms | 4640 KB |
10-small_random-12 | AC | 22 ms | 4636 KB |
10-small_random-13 | AC | 22 ms | 4508 KB |
10-small_random-14 | AC | 23 ms | 4640 KB |
10-small_random-15 | AC | 22 ms | 4636 KB |
10-small_random-16 | AC | 22 ms | 4636 KB |
10-small_random-17 | AC | 23 ms | 4636 KB |
10-small_random-18 | AC | 23 ms | 4636 KB |
10-small_random-19 | AC | 23 ms | 4508 KB |
20-small_tree-00 | AC | 27 ms | 4640 KB |
20-small_tree-01 | AC | 21 ms | 4640 KB |
20-small_tree-02 | AC | 31 ms | 4640 KB |
20-small_tree-03 | AC | 22 ms | 4636 KB |
20-small_tree-04 | AC | 1587 ms | 4640 KB |
21-small_path-00 | AC | 21 ms | 4632 KB |
21-small_path-01 | AC | 22 ms | 4640 KB |
21-small_path-02 | AC | 21 ms | 4632 KB |
21-small_path-03 | AC | 23 ms | 4640 KB |
21-small_path-04 | AC | 22 ms | 4636 KB |
30-large_random-00 | AC | 36 ms | 4512 KB |
30-large_random-01 | AC | 23 ms | 4640 KB |
30-large_random-02 | AC | 26 ms | 4516 KB |
30-large_random-03 | AC | 21 ms | 4636 KB |
30-large_random-04 | AC | 78 ms | 4640 KB |
30-large_random-05 | AC | 21 ms | 4636 KB |
30-large_random-06 | AC | 41 ms | 4640 KB |
30-large_random-07 | AC | 21 ms | 4640 KB |
30-large_random-08 | AC | 1664 ms | 4632 KB |
30-large_random-09 | AC | 1659 ms | 4640 KB |
40-large_comp-00 | AC | 21 ms | 4636 KB |
40-large_comp-01 | AC | 23 ms | 4640 KB |
40-large_comp-02 | AC | 21 ms | 4636 KB |
40-large_comp-03 | AC | 22 ms | 4640 KB |
40-large_comp-04 | AC | 26 ms | 4640 KB |
41-large_tree-00 | AC | 22 ms | 4636 KB |
41-large_tree-01 | AC | 22 ms | 4632 KB |
41-large_tree-02 | AC | 26 ms | 4508 KB |
41-large_tree-03 | AC | 173 ms | 4636 KB |
41-large_tree-04 | AC | 1584 ms | 4508 KB |
42-large_path-00 | AC | 61 ms | 4636 KB |
42-large_path-01 | AC | 21 ms | 4636 KB |
42-large_path-02 | AC | 23 ms | 4636 KB |
42-large_path-03 | AC | 655 ms | 4640 KB |
42-large_path-04 | AC | 1584 ms | 4512 KB |