이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long llint;
const int maxn = 1e6+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;
int n;
vector< int > graph[maxn];
pair< pair<int, int>, int > niz[maxn];
int sol[maxn];
llint f(pair<int, int> a, pair<int, int> b) {
	return (llint)a.X * b.Y - (llint)a.Y * b.X;
}
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
	return f(niz[0].X, a.X) > f(niz[0].X, b.X);
}
int t = 0;
void solve(int x, int parr) {
	//printf("solve: %d\n", x);
	sol[x] = niz[t++].Y;
	for (int tren : graph[x]) {
		if (tren == parr) continue;
		solve(tren, x);
	}
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	for (int i = 0; i < n; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		niz[i] = {{x, y}, i + 1};
	}
	sort(niz, niz+n);
	sort(niz+1, niz+n, cmp);
	//for (int i = 0; i < n; i++) 
	//	printf("%d %d -- %d\n", niz[i].X.X, niz[i].X.Y, niz[i].Y);
	solve(1, 0);
	for (int i = 1; i <= n; i++) printf("%d ", sol[i]);
	printf("\n");
	return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:40:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
Main.cpp:43:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |   scanf("%d%d", &a, &b);
      |   ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:50:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |   scanf("%d%d", &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |