Submission #787632

# Submission time Handle Problem Language Result Execution time Memory
787632 2023-07-19T10:32:51 Z doowey Drawing (CEOI22_drawing) C++17
100 / 100
193 ms 28108 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 << i + 1 << " ";
    }
    cout << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 68 ms 15748 KB Output is correct
2 Correct 73 ms 16468 KB Output is correct
3 Correct 74 ms 15044 KB Output is correct
4 Correct 124 ms 17800 KB Output is correct
5 Correct 73 ms 17752 KB Output is correct
6 Correct 74 ms 13192 KB Output is correct
7 Correct 81 ms 13696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5332 KB Output is correct
2 Correct 5 ms 5460 KB Output is correct
3 Correct 4 ms 5332 KB Output is correct
4 Correct 5 ms 5460 KB Output is correct
5 Correct 5 ms 5424 KB Output is correct
6 Correct 4 ms 5332 KB Output is correct
7 Correct 4 ms 5360 KB Output is correct
8 Correct 6 ms 5316 KB Output is correct
9 Correct 5 ms 5420 KB Output is correct
10 Correct 4 ms 5420 KB Output is correct
11 Correct 5 ms 5460 KB Output is correct
12 Correct 5 ms 5460 KB Output is correct
13 Correct 5 ms 5400 KB Output is correct
14 Correct 4 ms 5420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5332 KB Output is correct
2 Correct 5 ms 5460 KB Output is correct
3 Correct 4 ms 5332 KB Output is correct
4 Correct 5 ms 5460 KB Output is correct
5 Correct 5 ms 5424 KB Output is correct
6 Correct 4 ms 5332 KB Output is correct
7 Correct 4 ms 5360 KB Output is correct
8 Correct 6 ms 5316 KB Output is correct
9 Correct 5 ms 5420 KB Output is correct
10 Correct 4 ms 5420 KB Output is correct
11 Correct 5 ms 5460 KB Output is correct
12 Correct 5 ms 5460 KB Output is correct
13 Correct 5 ms 5400 KB Output is correct
14 Correct 4 ms 5420 KB Output is correct
15 Correct 9 ms 5952 KB Output is correct
16 Correct 8 ms 6228 KB Output is correct
17 Correct 7 ms 6064 KB Output is correct
18 Correct 7 ms 6356 KB Output is correct
19 Correct 7 ms 6356 KB Output is correct
20 Correct 10 ms 5856 KB Output is correct
21 Correct 8 ms 6060 KB Output is correct
22 Correct 9 ms 5956 KB Output is correct
23 Correct 9 ms 6084 KB Output is correct
24 Correct 7 ms 6100 KB Output is correct
25 Correct 8 ms 6384 KB Output is correct
26 Correct 8 ms 6228 KB Output is correct
27 Correct 8 ms 5936 KB Output is correct
28 Correct 8 ms 6060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5332 KB Output is correct
2 Correct 5 ms 5460 KB Output is correct
3 Correct 4 ms 5332 KB Output is correct
4 Correct 5 ms 5460 KB Output is correct
5 Correct 5 ms 5424 KB Output is correct
6 Correct 4 ms 5332 KB Output is correct
7 Correct 4 ms 5360 KB Output is correct
8 Correct 6 ms 5316 KB Output is correct
9 Correct 5 ms 5420 KB Output is correct
10 Correct 4 ms 5420 KB Output is correct
11 Correct 5 ms 5460 KB Output is correct
12 Correct 5 ms 5460 KB Output is correct
13 Correct 5 ms 5400 KB Output is correct
14 Correct 4 ms 5420 KB Output is correct
15 Correct 9 ms 5952 KB Output is correct
16 Correct 8 ms 6228 KB Output is correct
17 Correct 7 ms 6064 KB Output is correct
18 Correct 7 ms 6356 KB Output is correct
19 Correct 7 ms 6356 KB Output is correct
20 Correct 10 ms 5856 KB Output is correct
21 Correct 8 ms 6060 KB Output is correct
22 Correct 9 ms 5956 KB Output is correct
23 Correct 9 ms 6084 KB Output is correct
24 Correct 7 ms 6100 KB Output is correct
25 Correct 8 ms 6384 KB Output is correct
26 Correct 8 ms 6228 KB Output is correct
27 Correct 8 ms 5936 KB Output is correct
28 Correct 8 ms 6060 KB Output is correct
29 Correct 47 ms 10956 KB Output is correct
30 Correct 54 ms 13200 KB Output is correct
31 Correct 58 ms 12344 KB Output is correct
32 Correct 49 ms 14356 KB Output is correct
33 Correct 48 ms 13516 KB Output is correct
34 Correct 49 ms 10868 KB Output is correct
35 Correct 68 ms 11816 KB Output is correct
36 Correct 46 ms 10148 KB Output is correct
37 Correct 49 ms 12492 KB Output is correct
38 Correct 48 ms 12692 KB Output is correct
39 Correct 48 ms 13540 KB Output is correct
40 Correct 53 ms 12840 KB Output is correct
41 Correct 43 ms 10172 KB Output is correct
42 Correct 47 ms 11596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 15748 KB Output is correct
2 Correct 73 ms 16468 KB Output is correct
3 Correct 74 ms 15044 KB Output is correct
4 Correct 124 ms 17800 KB Output is correct
5 Correct 73 ms 17752 KB Output is correct
6 Correct 74 ms 13192 KB Output is correct
7 Correct 81 ms 13696 KB Output is correct
8 Correct 4 ms 5332 KB Output is correct
9 Correct 5 ms 5460 KB Output is correct
10 Correct 4 ms 5332 KB Output is correct
11 Correct 5 ms 5460 KB Output is correct
12 Correct 5 ms 5424 KB Output is correct
13 Correct 4 ms 5332 KB Output is correct
14 Correct 4 ms 5360 KB Output is correct
15 Correct 6 ms 5316 KB Output is correct
16 Correct 5 ms 5420 KB Output is correct
17 Correct 4 ms 5420 KB Output is correct
18 Correct 5 ms 5460 KB Output is correct
19 Correct 5 ms 5460 KB Output is correct
20 Correct 5 ms 5400 KB Output is correct
21 Correct 4 ms 5420 KB Output is correct
22 Correct 9 ms 5952 KB Output is correct
23 Correct 8 ms 6228 KB Output is correct
24 Correct 7 ms 6064 KB Output is correct
25 Correct 7 ms 6356 KB Output is correct
26 Correct 7 ms 6356 KB Output is correct
27 Correct 10 ms 5856 KB Output is correct
28 Correct 8 ms 6060 KB Output is correct
29 Correct 9 ms 5956 KB Output is correct
30 Correct 9 ms 6084 KB Output is correct
31 Correct 7 ms 6100 KB Output is correct
32 Correct 8 ms 6384 KB Output is correct
33 Correct 8 ms 6228 KB Output is correct
34 Correct 8 ms 5936 KB Output is correct
35 Correct 8 ms 6060 KB Output is correct
36 Correct 47 ms 10956 KB Output is correct
37 Correct 54 ms 13200 KB Output is correct
38 Correct 58 ms 12344 KB Output is correct
39 Correct 49 ms 14356 KB Output is correct
40 Correct 48 ms 13516 KB Output is correct
41 Correct 49 ms 10868 KB Output is correct
42 Correct 68 ms 11816 KB Output is correct
43 Correct 46 ms 10148 KB Output is correct
44 Correct 49 ms 12492 KB Output is correct
45 Correct 48 ms 12692 KB Output is correct
46 Correct 48 ms 13540 KB Output is correct
47 Correct 53 ms 12840 KB Output is correct
48 Correct 43 ms 10172 KB Output is correct
49 Correct 47 ms 11596 KB Output is correct
50 Correct 85 ms 13928 KB Output is correct
51 Correct 154 ms 24516 KB Output is correct
52 Correct 140 ms 22404 KB Output is correct
53 Correct 161 ms 25040 KB Output is correct
54 Correct 160 ms 28108 KB Output is correct
55 Correct 130 ms 18980 KB Output is correct
56 Correct 140 ms 19920 KB Output is correct
57 Correct 26 ms 8452 KB Output is correct
58 Correct 157 ms 22384 KB Output is correct
59 Correct 150 ms 21904 KB Output is correct
60 Correct 193 ms 27596 KB Output is correct
61 Correct 171 ms 24164 KB Output is correct
62 Correct 27 ms 8416 KB Output is correct
63 Correct 170 ms 19960 KB Output is correct