Submission #787632

#TimeUsernameProblemLanguageResultExecution timeMemory
787632dooweyDrawing (CEOI22_drawing)C++17
100 / 100
193 ms28108 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...