Submission #787610

# Submission time Handle Problem Language Result Execution time Memory
787610 2023-07-19T10:22:50 Z doowey Drawing (CEOI22_drawing) C++17
100 / 100
159 ms 33716 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

struct point{
    ll x;
    ll y;
    int id;
    bool operator< (const point &pp) const {
        if(x == pp.x)
            return y < pp.y;
        return x < pp.x;

    }
};

const int N = (int)2e5 + 10;
vector<int> T[N];

int P[N];
int tt = 0;
vector<point> pp;

void dfs(int u, int par){
    P[pp[tt].id]=u;
    tt++;
    for(auto x : T[u]){
        if(x == par) continue;
        dfs(x, u);
    }
}

int main(){
    fastIO;
    int n;
    cin >> n;
    int u, v;
    for(int i = 1; i < n; i ++ ){
        cin >> u >> v;
        T[u].push_back(v);
        T[v].push_back(u);
    }
    pp.resize(n);
    for(int i = 0 ; i < n; i ++) {
        cin >> pp[i].x >> pp[i].y;
        pp[i].id = i;
    }
    sort(pp.begin(), pp.end());
    dfs(1, -1);
    for(int i = 0 ; i < n; i ++ ){
        cout << P[i] << " ";
    }
    cout << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 64 ms 12384 KB Output is correct
2 Correct 69 ms 19056 KB Output is correct
3 Correct 66 ms 17664 KB Output is correct
4 Correct 82 ms 20840 KB Output is correct
5 Correct 95 ms 20292 KB Output is correct
6 Correct 72 ms 15808 KB Output is correct
7 Correct 64 ms 16356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5204 KB Output is correct
2 Correct 4 ms 5460 KB Output is correct
3 Correct 6 ms 5332 KB Output is correct
4 Correct 4 ms 5544 KB Output is correct
5 Correct 6 ms 5604 KB Output is correct
6 Correct 4 ms 5332 KB Output is correct
7 Correct 6 ms 5440 KB Output is correct
8 Correct 4 ms 5332 KB Output is correct
9 Correct 4 ms 5460 KB Output is correct
10 Correct 5 ms 5460 KB Output is correct
11 Correct 4 ms 5488 KB Output is correct
12 Correct 4 ms 5460 KB Output is correct
13 Correct 5 ms 5332 KB Output is correct
14 Correct 4 ms 5332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5204 KB Output is correct
2 Correct 4 ms 5460 KB Output is correct
3 Correct 6 ms 5332 KB Output is correct
4 Correct 4 ms 5544 KB Output is correct
5 Correct 6 ms 5604 KB Output is correct
6 Correct 4 ms 5332 KB Output is correct
7 Correct 6 ms 5440 KB Output is correct
8 Correct 4 ms 5332 KB Output is correct
9 Correct 4 ms 5460 KB Output is correct
10 Correct 5 ms 5460 KB Output is correct
11 Correct 4 ms 5488 KB Output is correct
12 Correct 4 ms 5460 KB Output is correct
13 Correct 5 ms 5332 KB Output is correct
14 Correct 4 ms 5332 KB Output is correct
15 Correct 7 ms 5844 KB Output is correct
16 Correct 8 ms 6132 KB Output is correct
17 Correct 11 ms 5972 KB Output is correct
18 Correct 9 ms 6228 KB Output is correct
19 Correct 7 ms 6336 KB Output is correct
20 Correct 8 ms 5844 KB Output is correct
21 Correct 7 ms 6100 KB Output is correct
22 Correct 7 ms 5932 KB Output is correct
23 Correct 7 ms 6100 KB Output is correct
24 Correct 7 ms 6060 KB Output is correct
25 Correct 7 ms 6356 KB Output is correct
26 Correct 7 ms 6228 KB Output is correct
27 Correct 8 ms 5952 KB Output is correct
28 Correct 8 ms 6060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5204 KB Output is correct
2 Correct 4 ms 5460 KB Output is correct
3 Correct 6 ms 5332 KB Output is correct
4 Correct 4 ms 5544 KB Output is correct
5 Correct 6 ms 5604 KB Output is correct
6 Correct 4 ms 5332 KB Output is correct
7 Correct 6 ms 5440 KB Output is correct
8 Correct 4 ms 5332 KB Output is correct
9 Correct 4 ms 5460 KB Output is correct
10 Correct 5 ms 5460 KB Output is correct
11 Correct 4 ms 5488 KB Output is correct
12 Correct 4 ms 5460 KB Output is correct
13 Correct 5 ms 5332 KB Output is correct
14 Correct 4 ms 5332 KB Output is correct
15 Correct 7 ms 5844 KB Output is correct
16 Correct 8 ms 6132 KB Output is correct
17 Correct 11 ms 5972 KB Output is correct
18 Correct 9 ms 6228 KB Output is correct
19 Correct 7 ms 6336 KB Output is correct
20 Correct 8 ms 5844 KB Output is correct
21 Correct 7 ms 6100 KB Output is correct
22 Correct 7 ms 5932 KB Output is correct
23 Correct 7 ms 6100 KB Output is correct
24 Correct 7 ms 6060 KB Output is correct
25 Correct 7 ms 6356 KB Output is correct
26 Correct 7 ms 6228 KB Output is correct
27 Correct 8 ms 5952 KB Output is correct
28 Correct 8 ms 6060 KB Output is correct
29 Correct 49 ms 12604 KB Output is correct
30 Correct 58 ms 15052 KB Output is correct
31 Correct 45 ms 14040 KB Output is correct
32 Correct 45 ms 15648 KB Output is correct
33 Correct 47 ms 15180 KB Output is correct
34 Correct 44 ms 12600 KB Output is correct
35 Correct 60 ms 13136 KB Output is correct
36 Correct 41 ms 11592 KB Output is correct
37 Correct 49 ms 14264 KB Output is correct
38 Correct 49 ms 14428 KB Output is correct
39 Correct 51 ms 15176 KB Output is correct
40 Correct 46 ms 14232 KB Output is correct
41 Correct 48 ms 11608 KB Output is correct
42 Correct 45 ms 13292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 12384 KB Output is correct
2 Correct 69 ms 19056 KB Output is correct
3 Correct 66 ms 17664 KB Output is correct
4 Correct 82 ms 20840 KB Output is correct
5 Correct 95 ms 20292 KB Output is correct
6 Correct 72 ms 15808 KB Output is correct
7 Correct 64 ms 16356 KB Output is correct
8 Correct 4 ms 5204 KB Output is correct
9 Correct 4 ms 5460 KB Output is correct
10 Correct 6 ms 5332 KB Output is correct
11 Correct 4 ms 5544 KB Output is correct
12 Correct 6 ms 5604 KB Output is correct
13 Correct 4 ms 5332 KB Output is correct
14 Correct 6 ms 5440 KB Output is correct
15 Correct 4 ms 5332 KB Output is correct
16 Correct 4 ms 5460 KB Output is correct
17 Correct 5 ms 5460 KB Output is correct
18 Correct 4 ms 5488 KB Output is correct
19 Correct 4 ms 5460 KB Output is correct
20 Correct 5 ms 5332 KB Output is correct
21 Correct 4 ms 5332 KB Output is correct
22 Correct 7 ms 5844 KB Output is correct
23 Correct 8 ms 6132 KB Output is correct
24 Correct 11 ms 5972 KB Output is correct
25 Correct 9 ms 6228 KB Output is correct
26 Correct 7 ms 6336 KB Output is correct
27 Correct 8 ms 5844 KB Output is correct
28 Correct 7 ms 6100 KB Output is correct
29 Correct 7 ms 5932 KB Output is correct
30 Correct 7 ms 6100 KB Output is correct
31 Correct 7 ms 6060 KB Output is correct
32 Correct 7 ms 6356 KB Output is correct
33 Correct 7 ms 6228 KB Output is correct
34 Correct 8 ms 5952 KB Output is correct
35 Correct 8 ms 6060 KB Output is correct
36 Correct 49 ms 12604 KB Output is correct
37 Correct 58 ms 15052 KB Output is correct
38 Correct 45 ms 14040 KB Output is correct
39 Correct 45 ms 15648 KB Output is correct
40 Correct 47 ms 15180 KB Output is correct
41 Correct 44 ms 12600 KB Output is correct
42 Correct 60 ms 13136 KB Output is correct
43 Correct 41 ms 11592 KB Output is correct
44 Correct 49 ms 14264 KB Output is correct
45 Correct 49 ms 14428 KB Output is correct
46 Correct 51 ms 15176 KB Output is correct
47 Correct 46 ms 14232 KB Output is correct
48 Correct 48 ms 11608 KB Output is correct
49 Correct 45 ms 13292 KB Output is correct
50 Correct 75 ms 17008 KB Output is correct
51 Correct 134 ms 29940 KB Output is correct
52 Correct 148 ms 27856 KB Output is correct
53 Correct 152 ms 29988 KB Output is correct
54 Correct 159 ms 33716 KB Output is correct
55 Correct 137 ms 24424 KB Output is correct
56 Correct 135 ms 25376 KB Output is correct
57 Correct 27 ms 9020 KB Output is correct
58 Correct 158 ms 27736 KB Output is correct
59 Correct 128 ms 27280 KB Output is correct
60 Correct 150 ms 32992 KB Output is correct
61 Correct 138 ms 29028 KB Output is correct
62 Correct 24 ms 9004 KB Output is correct
63 Correct 134 ms 25328 KB Output is correct