#include <bits/stdc++.h>
///#include <fstream>
#define endl '\n'
#define mod 998244353
#define INF 100000000000000
#define ll long long
///#define cin fin
///#define cout fout
#define fi first
#define se second
using namespace std;
///ofstream fout("herding.out");
///ifstream fin("herding.in");
bool cmp(pair<pair<long long, int>,pair<long long, long long>> a, pair<pair<long long, int>,pair<long long, long long>> b) {
if(a.fi.fi != b.fi.fi) return a.fi.fi > b.fi.fi;
else return a.fi.se < b.fi.se;
}
int main()
{
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
int n; cin >> n; pair<pair<long long, int>,pair<long long, long long>> arr[n]; int ans[n];
for(int i = 0; i < n; i++) ans[i] = i+1;
for(int i = 0; i < n; i++) {
long long x, y, r; cin >> x >> y >> r;
arr[i].fi.fi = r; arr[i].fi.se = i;
arr[i].se.fi = x; arr[i].se.se = y;
}
sort(arr,arr+n,cmp);
for(int i = 0; i < n; i++) {
if(ans[arr[i].fi.se] != arr[i].fi.se+1) continue;
for(int j = i+1; j < n; j++) {
cout << arr[i].fi.fi << ' ' << arr[i].fi.se << ' ' << arr[i].se.fi << ' ' << arr[i].se.se << 'k' << endl;
cout << arr[j].fi.fi << ' ' << arr[j].fi.se << ' ' << arr[j].se.fi << ' ' << arr[j].se.se << 'j' << endl;
long long x1 = arr[i].se.fi, y1 = arr[i].se.se, r1 = arr[i].fi.fi;
long long x2 = arr[j].se.fi, y2 = arr[j].se.se, r2 = arr[j].fi.fi;
if((y1+r1 == y2-r2 || y1-r1 == y2+r2) && x1 == x2) {
ans[arr[j].fi.se] = arr[i].fi.se;
}
else if(y1 == y2 && (x1+r1 == x2-r2 || x1-r1 == x2+r2)) {
ans[arr[j].fi.se] = arr[i].fi.se;
}
else if(x2 > x1 && y1-r1 < y2+r2 && x1+r1 > x2) {
ans[arr[j].fi.se] = arr[i].fi.se;
}
else if(x2 < x1 && y1+r1 > y2-r2 && x1-r1 < x2) {
ans[arr[j].fi.se] = arr[i].fi.se;
}
else if( y2 < y1 && y1-r1 < y2 && x1-r1 < x2+r2) {
ans[arr[j].fi.se] = arr[i].fi.se;
}
else if(y2 > y1 && y1+r1 > y2 && x1+r1 > x2-r2) {
ans[arr[j].fi.se] = arr[i].fi.se;
}
}
}
for(int i = 0; i < n; i++) cout << ans[i]+1 << ' ';
/* int n; cin >> n; long long arr[n]; vector<pair<pair<int,long long>,int>> v; long long ans[n];
for(int i = 0; i < n; i++) ans[i] = i+1;
for(int i = 0; i < n; i++) {
long long x, y, r; cin >> x >> y >> r; arr[i] = r;
v.push_back({{1,x-r},i});
v.push_back({{2,x+r},i});
}
sort(v.begin(),v.end()); priority_queue<pair<long long, long long>> pq;
for(int i = 0; i < v.size(); i++) {
int ind = v[i].second;
pq.push({arr[ind],-ind});
if(!pq.empty() &&)
}*/
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
510 ms |
50156 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3095 ms |
324756 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |