답안 #983349

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983349 2024-05-15T10:45:03 Z vjudge1 원 고르기 (APIO18_circle_selection) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, i, j, k, x[300001], y[300001], r[300001], ans[300001];
bool u[300001];
multiset<pair<int, int>> ms, mss;

long double dist(long double x1, long double y1, long double x2, long double y2) {
	return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}

bool inter(int i, int j) {
	return (r[i] + r[j]) * (r[i] + r[j]) >= dist(x[i], y[i], x[j], y[j]);
}

signed main() {
	cin.tie(0)->sync_with_stdio(0);
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	#endif
	cin >> n;
	bool subtask2 = 1;
	for (i = 1; i <= n; i++) {
		cin >> x[i] >> y[i] >> r[i];
		ms.insert({r[i], -i});
		//y[i] = 0;
		if (y[i] != 0) {
			subtask2 = 0;
		}
	}
	for (i = 1; i <= n; i++) {
		if (ms.empty()) break;
		k = -(*ms.rbegin()).second;
		ms.erase(prev(ms.end()));
		ans[k] = k;
		for (auto j : ms) {
			if (inter(k, -j.second)) {
				ans[-j.second] = k;
			}
			else mss.insert(j);
		}
		ms = mss;
		mss.clear();
	} //
	for (i = 1; i <= n; i++) cout << ans[i] << " ";
}

Compilation message

circle_selection.cpp: In function 'long double dist(long double, long double, long double, long double)':
circle_selection.cpp:9:54: error: expected ';' before ')' token
    9 |  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
      |                                                      ^
      |                                                      ;
circle_selection.cpp:9:54: error: expected primary-expression before ')' token