#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#define str string
#define append push_back
#define vector deque
#define vi vector<int>
#define int long long
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define endl '\n'
#define all(ls) ls.begin(),ls.end()
#define sorted(ls) sort(ls.begin(),ls.end());
#define reversed(ls) reverse(ls.begin(),ls.end());
#define print(n) for(auto i:n)cout<<i<<' ';cout<<endl;
#define input(n,ls,m) deque<n>ls(m);for(int i=0;i<m;i++)cin>>ls[i];
#define len(s) s.size()
#define ff first
#define ss second
#define N (int const) 1e5+1
#define pii pair<int,int>
#define SQ(x) ((x)*(x))
#define float double
int mod=1e9+7;
int mod1=998244353;
int sum_(vector<int>ls){int s=0;for(auto i:ls){s+=i;}return s;}
int min(int a,int b){if (a>b){return b;}return a;}
int max(int a,int b){if (a<b){return b;}return a;}
//......................................tHe ReaL cOdE beGinS HerE....................................../
void solve(){
int n;
cin>>n;
vector<int>plane[n];
bool mp[n];
for(int i=0;i<n;i++){
input(int,a,3);
mp[i]=0;
a={a[2],n-i,a[0],a[1]};
plane[i]=a;
}
sort(plane,plane+n);
reverse(plane,plane+n);
vi ans(n,0);
for(int i=0;i<n;i++){
ans[i]=i;
plane[i][1]=n-plane[i][1];
}
for(auto i:plane){
if(mp[i[1]]) continue;
mp[i[1]]=1;
for(auto j:plane){
if(i[1]==j[1] or mp[j[1]]){continue;}
if(ceil(sqrtl(SQ(j[2]-i[2])+SQ(j[3]-i[3])))<=j[0]+i[0]){
mp[j[1]]=1;
ans[j[1]]=i[1];
}
}
}
for(auto i:ans){
cout<<i+1<<' ';
}
cout<<endl;
}
signed main(){
int t=1;
// cin>>t;
while(t--){
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
352 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
1628 KB |
Output is correct |
17 |
Correct |
2 ms |
1628 KB |
Output is correct |
18 |
Correct |
2 ms |
1628 KB |
Output is correct |
19 |
Correct |
10 ms |
6236 KB |
Output is correct |
20 |
Correct |
14 ms |
6440 KB |
Output is correct |
21 |
Correct |
12 ms |
6236 KB |
Output is correct |
22 |
Correct |
1711 ms |
6408 KB |
Output is correct |
23 |
Correct |
1687 ms |
6404 KB |
Output is correct |
24 |
Correct |
1672 ms |
6404 KB |
Output is correct |
25 |
Correct |
1724 ms |
6408 KB |
Output is correct |
26 |
Correct |
1674 ms |
6404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1067 ms |
361996 KB |
Output is correct |
2 |
Correct |
1159 ms |
362416 KB |
Output is correct |
3 |
Correct |
1106 ms |
361936 KB |
Output is correct |
4 |
Correct |
1064 ms |
362068 KB |
Output is correct |
5 |
Execution timed out |
3060 ms |
359904 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Execution timed out |
3109 ms |
120400 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3022 ms |
360272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
352 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
1628 KB |
Output is correct |
17 |
Correct |
2 ms |
1628 KB |
Output is correct |
18 |
Correct |
2 ms |
1628 KB |
Output is correct |
19 |
Correct |
10 ms |
6236 KB |
Output is correct |
20 |
Correct |
14 ms |
6440 KB |
Output is correct |
21 |
Correct |
12 ms |
6236 KB |
Output is correct |
22 |
Correct |
1711 ms |
6408 KB |
Output is correct |
23 |
Correct |
1687 ms |
6404 KB |
Output is correct |
24 |
Correct |
1672 ms |
6404 KB |
Output is correct |
25 |
Correct |
1724 ms |
6408 KB |
Output is correct |
26 |
Correct |
1674 ms |
6404 KB |
Output is correct |
27 |
Correct |
26 ms |
12380 KB |
Output is correct |
28 |
Correct |
21 ms |
12380 KB |
Output is correct |
29 |
Correct |
23 ms |
12356 KB |
Output is correct |
30 |
Execution timed out |
3049 ms |
12380 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
352 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
1628 KB |
Output is correct |
17 |
Correct |
2 ms |
1628 KB |
Output is correct |
18 |
Correct |
2 ms |
1628 KB |
Output is correct |
19 |
Correct |
10 ms |
6236 KB |
Output is correct |
20 |
Correct |
14 ms |
6440 KB |
Output is correct |
21 |
Correct |
12 ms |
6236 KB |
Output is correct |
22 |
Correct |
1711 ms |
6408 KB |
Output is correct |
23 |
Correct |
1687 ms |
6404 KB |
Output is correct |
24 |
Correct |
1672 ms |
6404 KB |
Output is correct |
25 |
Correct |
1724 ms |
6408 KB |
Output is correct |
26 |
Correct |
1674 ms |
6404 KB |
Output is correct |
27 |
Correct |
1067 ms |
361996 KB |
Output is correct |
28 |
Correct |
1159 ms |
362416 KB |
Output is correct |
29 |
Correct |
1106 ms |
361936 KB |
Output is correct |
30 |
Correct |
1064 ms |
362068 KB |
Output is correct |
31 |
Execution timed out |
3060 ms |
359904 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |