# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1057751 | 2024-08-14T05:18:17 Z | 123(#11113) | Infiltration (CCO24_day2problem1) | C++17 | 6 ms | 600 KB |
#include <bits/stdc++.h> using namespace std; vector<int> adj[105]; int p[105]; void dfs(int v,int pr) { p[v]=pr; for(int i=0;i<adj[v].size();i++) { int nt=adj[v][i]; if (pr!=nt) { dfs(nt,v); } } } int main(void) { int n; scanf("%d",&n); if (n!=100) { return 0; } for(int i=1;i<n;i++) { int u,v; scanf("%d %d",&u,&v); adj[u].push_back(v); adj[v].push_back(u); } dfs(0,-1); int t=n*3; printf("%d\n",t); for(int i=0;i<n;i++) { int now=i; int pr; int pr2; for(int j=0;j<t;j++) { if (j%2==0) { if (j/2==0) { if (p[now]!=-1) now=p[now]; } if (j/2==1) { pr2=now; if (p[now]!=-1) { now=p[now]; } } if (j/2==2) { pr=now; if (p[now]!=-1) { now=p[now]; } } if (j/2==3) { now=pr; } if (j/2==4) { now=pr2; } if (j/2>=6) { if (p[now]!=-1) { now=p[now]; } } } printf("%d ",now); } printf("\n"); } for(int i=0;i<n;i++) { int now=i; for(int j=0;j<t;j++) { if (j%2==1) { if (j/2==0) { if (p[now]!=-1) now=p[now]; } if (j/2==4) { if (p[now]!=-1) { now=p[now]; } } if (j/2==5) { if (p[now]!=-1) { now=p[now]; } } if (j/2>=6) { if (p[now]!=-1) { now=p[now]; } } } printf("%d",now); if (j!=t-1) { printf(" "); } } printf("\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 4 ms | 348 KB | Partially correct |
2 | Partially correct | 3 ms | 524 KB | Partially correct |
3 | Partially correct | 3 ms | 348 KB | Partially correct |
4 | Partially correct | 4 ms | 348 KB | Partially correct |
5 | Partially correct | 3 ms | 524 KB | Partially correct |
6 | Partially correct | 3 ms | 348 KB | Partially correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 348 KB | Output is correct |
12 | Correct | 3 ms | 348 KB | Output is correct |
13 | Correct | 3 ms | 348 KB | Output is correct |
14 | Correct | 3 ms | 464 KB | Output is correct |
15 | Correct | 3 ms | 348 KB | Output is correct |
16 | Partially correct | 6 ms | 508 KB | Partially correct |
17 | Partially correct | 5 ms | 348 KB | Partially correct |
18 | Correct | 4 ms | 344 KB | Output is correct |
19 | Correct | 4 ms | 600 KB | Output is correct |
20 | Partially correct | 3 ms | 348 KB | Partially correct |
21 | Partially correct | 5 ms | 348 KB | Partially correct |
22 | Partially correct | 5 ms | 556 KB | Partially correct |
23 | Partially correct | 3 ms | 344 KB | Partially correct |
24 | Partially correct | 3 ms | 348 KB | Partially correct |
25 | Partially correct | 3 ms | 348 KB | Partially correct |