#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
using namespace std;
const int N = 3e5 + 10, mod = 1e9 + 7;
unordered_map<int, vector<int> > st, en;
vector<pair<int, pair<int, int> > > v;
int n, ans[N];
signed main()
{
FAST;
cin >> n;
for(int i = 1; i <= n; i++) {
int x, y, r;
cin >> x >> y >> r;
st[x - r].push_back(i);
en[x + r].push_back(i);
v.push_back({2 * r, {-i, x - r}});
}
sort(all(v));
reverse(all(v));
for(auto it : v) {
for(int i = it.second.second; i <= it.second.second + it.first; i++) {
for(auto j : st[i]) if(!ans[j]) ans[j] = -it.second.first;
st[i].clear();
for(auto j : en[i]) if(!ans[j]) ans[j] = -it.second.first;
en[i].clear();
}
if(!ans[it.second.first]) ans[it.second.first] = -it.second.first;
}
for(int i = 1; i <= n; i++) cout << ans[i] << ' ';
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1333 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3132 ms |
1033152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1346 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3136 ms |
829296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1333 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1333 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |