답안 #698410

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698410 2023-02-13T11:40:11 Z vjudge1 Drawing (CEOI22_drawing) C++14
100 / 100
241 ms 39432 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
struct Point {
  int X, Y, id;
  bool operator<(const Point& p) const {
    if (X != p.X) return X < p.X;
    return Y < p.Y;
  }
};
const int NN = 1e6 + 10;
vector<int> G[NN];
Point Ps[NN];
int N, Ans[NN];
LL cross(const Point& a, const Point& b, const Point& c) {
  return (LL)a.X * (b.Y - c.Y) + (LL)b.X * (c.Y - a.Y) + (LL)c.X * (a.Y - b.Y);
}
bool cmp(const Point& a, const Point& b) { return cross(Ps[0], a, b) >= 0; }
void dfs(int u, int fa, int& pi) {
  Ans[u] = Ps[pi++].id;
  for (int v : G[u])
    if (v != fa) dfs(v, u, pi);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> N;
  for (int i = 1, a, b; i < N; i++)
    cin >> a >> b, G[a].push_back(b), G[b].push_back(a);
  for (int i = 0, x, y; i < N; i++) cin >> x >> y, Ps[i] = {x, y, i + 1};
  sort(Ps, Ps + N), sort(Ps + 1, Ps + N, cmp);
  int pi = 0;
  dfs(1, 0, pi);
  for (int i = 1; i <= N; i++) printf("%d ", Ans[i]);
  puts("");
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 102 ms 30088 KB Output is correct
2 Correct 136 ms 31644 KB Output is correct
3 Correct 112 ms 30980 KB Output is correct
4 Correct 124 ms 32564 KB Output is correct
5 Correct 139 ms 32316 KB Output is correct
6 Correct 114 ms 29972 KB Output is correct
7 Correct 111 ms 30460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 24020 KB Output is correct
2 Correct 16 ms 24096 KB Output is correct
3 Correct 16 ms 24156 KB Output is correct
4 Correct 15 ms 24168 KB Output is correct
5 Correct 16 ms 24148 KB Output is correct
6 Correct 16 ms 24064 KB Output is correct
7 Correct 15 ms 24148 KB Output is correct
8 Correct 16 ms 24116 KB Output is correct
9 Correct 18 ms 24148 KB Output is correct
10 Correct 18 ms 24072 KB Output is correct
11 Correct 16 ms 24148 KB Output is correct
12 Correct 16 ms 24116 KB Output is correct
13 Correct 17 ms 24076 KB Output is correct
14 Correct 16 ms 24148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 24020 KB Output is correct
2 Correct 16 ms 24096 KB Output is correct
3 Correct 16 ms 24156 KB Output is correct
4 Correct 15 ms 24168 KB Output is correct
5 Correct 16 ms 24148 KB Output is correct
6 Correct 16 ms 24064 KB Output is correct
7 Correct 15 ms 24148 KB Output is correct
8 Correct 16 ms 24116 KB Output is correct
9 Correct 18 ms 24148 KB Output is correct
10 Correct 18 ms 24072 KB Output is correct
11 Correct 16 ms 24148 KB Output is correct
12 Correct 16 ms 24116 KB Output is correct
13 Correct 17 ms 24076 KB Output is correct
14 Correct 16 ms 24148 KB Output is correct
15 Correct 20 ms 24592 KB Output is correct
16 Correct 20 ms 24732 KB Output is correct
17 Correct 20 ms 24524 KB Output is correct
18 Correct 20 ms 24784 KB Output is correct
19 Correct 20 ms 24764 KB Output is correct
20 Correct 22 ms 24532 KB Output is correct
21 Correct 23 ms 24660 KB Output is correct
22 Correct 21 ms 24592 KB Output is correct
23 Correct 21 ms 24624 KB Output is correct
24 Correct 20 ms 24592 KB Output is correct
25 Correct 20 ms 24764 KB Output is correct
26 Correct 22 ms 24696 KB Output is correct
27 Correct 21 ms 24456 KB Output is correct
28 Correct 21 ms 24532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 24020 KB Output is correct
2 Correct 16 ms 24096 KB Output is correct
3 Correct 16 ms 24156 KB Output is correct
4 Correct 15 ms 24168 KB Output is correct
5 Correct 16 ms 24148 KB Output is correct
6 Correct 16 ms 24064 KB Output is correct
7 Correct 15 ms 24148 KB Output is correct
8 Correct 16 ms 24116 KB Output is correct
9 Correct 18 ms 24148 KB Output is correct
10 Correct 18 ms 24072 KB Output is correct
11 Correct 16 ms 24148 KB Output is correct
12 Correct 16 ms 24116 KB Output is correct
13 Correct 17 ms 24076 KB Output is correct
14 Correct 16 ms 24148 KB Output is correct
15 Correct 20 ms 24592 KB Output is correct
16 Correct 20 ms 24732 KB Output is correct
17 Correct 20 ms 24524 KB Output is correct
18 Correct 20 ms 24784 KB Output is correct
19 Correct 20 ms 24764 KB Output is correct
20 Correct 22 ms 24532 KB Output is correct
21 Correct 23 ms 24660 KB Output is correct
22 Correct 21 ms 24592 KB Output is correct
23 Correct 21 ms 24624 KB Output is correct
24 Correct 20 ms 24592 KB Output is correct
25 Correct 20 ms 24764 KB Output is correct
26 Correct 22 ms 24696 KB Output is correct
27 Correct 21 ms 24456 KB Output is correct
28 Correct 21 ms 24532 KB Output is correct
29 Correct 120 ms 28256 KB Output is correct
30 Correct 88 ms 29480 KB Output is correct
31 Correct 78 ms 29056 KB Output is correct
32 Correct 86 ms 29972 KB Output is correct
33 Correct 87 ms 29684 KB Output is correct
34 Correct 80 ms 28176 KB Output is correct
35 Correct 92 ms 28560 KB Output is correct
36 Correct 72 ms 27624 KB Output is correct
37 Correct 80 ms 29064 KB Output is correct
38 Correct 86 ms 29072 KB Output is correct
39 Correct 82 ms 29620 KB Output is correct
40 Correct 88 ms 29508 KB Output is correct
41 Correct 70 ms 27624 KB Output is correct
42 Correct 82 ms 28612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 102 ms 30088 KB Output is correct
2 Correct 136 ms 31644 KB Output is correct
3 Correct 112 ms 30980 KB Output is correct
4 Correct 124 ms 32564 KB Output is correct
5 Correct 139 ms 32316 KB Output is correct
6 Correct 114 ms 29972 KB Output is correct
7 Correct 111 ms 30460 KB Output is correct
8 Correct 16 ms 24020 KB Output is correct
9 Correct 16 ms 24096 KB Output is correct
10 Correct 16 ms 24156 KB Output is correct
11 Correct 15 ms 24168 KB Output is correct
12 Correct 16 ms 24148 KB Output is correct
13 Correct 16 ms 24064 KB Output is correct
14 Correct 15 ms 24148 KB Output is correct
15 Correct 16 ms 24116 KB Output is correct
16 Correct 18 ms 24148 KB Output is correct
17 Correct 18 ms 24072 KB Output is correct
18 Correct 16 ms 24148 KB Output is correct
19 Correct 16 ms 24116 KB Output is correct
20 Correct 17 ms 24076 KB Output is correct
21 Correct 16 ms 24148 KB Output is correct
22 Correct 20 ms 24592 KB Output is correct
23 Correct 20 ms 24732 KB Output is correct
24 Correct 20 ms 24524 KB Output is correct
25 Correct 20 ms 24784 KB Output is correct
26 Correct 20 ms 24764 KB Output is correct
27 Correct 22 ms 24532 KB Output is correct
28 Correct 23 ms 24660 KB Output is correct
29 Correct 21 ms 24592 KB Output is correct
30 Correct 21 ms 24624 KB Output is correct
31 Correct 20 ms 24592 KB Output is correct
32 Correct 20 ms 24764 KB Output is correct
33 Correct 22 ms 24696 KB Output is correct
34 Correct 21 ms 24456 KB Output is correct
35 Correct 21 ms 24532 KB Output is correct
36 Correct 120 ms 28256 KB Output is correct
37 Correct 88 ms 29480 KB Output is correct
38 Correct 78 ms 29056 KB Output is correct
39 Correct 86 ms 29972 KB Output is correct
40 Correct 87 ms 29684 KB Output is correct
41 Correct 80 ms 28176 KB Output is correct
42 Correct 92 ms 28560 KB Output is correct
43 Correct 72 ms 27624 KB Output is correct
44 Correct 80 ms 29064 KB Output is correct
45 Correct 86 ms 29072 KB Output is correct
46 Correct 82 ms 29620 KB Output is correct
47 Correct 88 ms 29508 KB Output is correct
48 Correct 70 ms 27624 KB Output is correct
49 Correct 82 ms 28612 KB Output is correct
50 Correct 121 ms 30752 KB Output is correct
51 Correct 241 ms 37624 KB Output is correct
52 Correct 224 ms 36548 KB Output is correct
53 Correct 234 ms 37896 KB Output is correct
54 Correct 232 ms 39432 KB Output is correct
55 Correct 218 ms 34716 KB Output is correct
56 Correct 229 ms 35176 KB Output is correct
57 Correct 49 ms 26188 KB Output is correct
58 Correct 235 ms 36576 KB Output is correct
59 Correct 231 ms 36192 KB Output is correct
60 Correct 231 ms 39216 KB Output is correct
61 Correct 234 ms 37404 KB Output is correct
62 Correct 46 ms 26184 KB Output is correct
63 Correct 240 ms 35212 KB Output is correct