이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#include <bits/stdc++.h>
#include <random>
#include <algorithm>
#include <bitset>
#include <chrono>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#define fr first
#define sc second
#define ad push_back
using namespace std;
using ll = long long;
mt19937 rnd(348502);
const int N = 200005;
vector<pair<ll, pair<ll, ll>>> v;
int color[N];
int ans[N];
void solve()
{
int n, i, j, x, y, r;
cin >> n;
for ( i = 0; i < n; i++)
{
cin >> x >> y >> r;
v.push_back({ r, {x, y} });
}
int qan = 0;
for ( i = 0; i < n; i++)
{
ll ma = 0;
for ( j = 0; j < n; j++)
{
if (color[j] == 0)
{
ma = max(v[j].first, ma);
}
}
for ( j = 0; j < n; j++)
{
if (color[j] == 0 && v[j].first == ma)
{
color[j] = 1;
ans[j] = j + 1;
qan++;
for (int h = 0; h < n; h++)
{
if (color[h] == 0 && (v[j].second.first - v[h].second.first) * (v[j].second.first - v[h].second.first) + (v[j].second.second - v[h].second.second) * (v[j].second.second - v[h].second.second) <= (v[j].first + v[h].first) * (v[j].first + v[h].first))
{
color[h] = 1;
ans[h] = j + 1;
qan++;
}
}
break;
}
}
if (qan == n)
break;
}
for ( i = 0; i < n; i++)
{
cout << ans[i] << ' ';
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int tt = 1;
//cin >> tt;
while (tt--) {
solve();
}
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |