답안 #59932

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
59932 2018-07-23T10:27:07 Z Flugan42 원 고르기 (APIO18_circle_selection) C++14
7 / 100
3000 ms 16832 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define per(i,a,b) for(int i = a; i >= b; i--)
#define inf 1000000000000000000
#define sz(x) (ll)(x).size()
#define all(x) x.begin(),x.end()

struct circle {
  ll x,y,r,id;
} ;
vector< circle > inp;
vi vis;
circle _;
ll n;

bool mysort(circle a, circle b){
  if (a.r == b.r) return a.id < b.id;
  return a.r > b.r;
}

ld dist(ll i, ll j){
  ll dx = inp[i].x-inp[j].x, dy = inp[i].y-inp[j].y;
  return sqrt(ld(dx*dx)+ld(dy*dy));
}

int main(){
  cin >> n; inp.assign(n,_);
  rep(i,0,n){
    cin >> inp[i].x >> inp[i].y >> inp[i].r;
    inp[i].id = i;
  }
  sort(all(inp),mysort);
  vis.assign(n,-1);
  rep(i,0,n){
    if (vis[i] != -1) continue;
    rep(j,0,n){
      if (vis[j] != -1) continue;
      if (dist(i,j) <= inp[i].r+inp[j].r) vis[j] = inp[i].id;
    }
  }
  vi res; res.assign(n,0);
  rep(i,0,n){
    res[inp[i].id] = vis[i];
  }
  rep(i,0,n) cout << res[i]+1 << " ";
  cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 3 ms 484 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
6 Correct 3 ms 568 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 3 ms 628 KB Output is correct
11 Correct 3 ms 628 KB Output is correct
12 Correct 2 ms 628 KB Output is correct
13 Correct 3 ms 628 KB Output is correct
14 Correct 3 ms 628 KB Output is correct
15 Correct 3 ms 628 KB Output is correct
16 Correct 5 ms 776 KB Output is correct
17 Correct 5 ms 776 KB Output is correct
18 Correct 5 ms 776 KB Output is correct
19 Correct 12 ms 892 KB Output is correct
20 Correct 13 ms 1020 KB Output is correct
21 Correct 13 ms 1020 KB Output is correct
22 Correct 156 ms 1020 KB Output is correct
23 Correct 148 ms 1020 KB Output is correct
24 Correct 145 ms 1020 KB Output is correct
25 Correct 156 ms 1020 KB Output is correct
26 Correct 166 ms 1020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 604 ms 16752 KB Output is correct
2 Correct 594 ms 16832 KB Output is correct
3 Correct 518 ms 16832 KB Output is correct
4 Correct 596 ms 16832 KB Output is correct
5 Execution timed out 3066 ms 16832 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 16832 KB Output is correct
2 Execution timed out 3041 ms 16832 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3050 ms 16832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 3 ms 484 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
6 Correct 3 ms 568 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 3 ms 628 KB Output is correct
11 Correct 3 ms 628 KB Output is correct
12 Correct 2 ms 628 KB Output is correct
13 Correct 3 ms 628 KB Output is correct
14 Correct 3 ms 628 KB Output is correct
15 Correct 3 ms 628 KB Output is correct
16 Correct 5 ms 776 KB Output is correct
17 Correct 5 ms 776 KB Output is correct
18 Correct 5 ms 776 KB Output is correct
19 Correct 12 ms 892 KB Output is correct
20 Correct 13 ms 1020 KB Output is correct
21 Correct 13 ms 1020 KB Output is correct
22 Correct 156 ms 1020 KB Output is correct
23 Correct 148 ms 1020 KB Output is correct
24 Correct 145 ms 1020 KB Output is correct
25 Correct 156 ms 1020 KB Output is correct
26 Correct 166 ms 1020 KB Output is correct
27 Correct 20 ms 16832 KB Output is correct
28 Correct 22 ms 16832 KB Output is correct
29 Correct 26 ms 16832 KB Output is correct
30 Correct 539 ms 16832 KB Output is correct
31 Correct 577 ms 16832 KB Output is correct
32 Correct 521 ms 16832 KB Output is correct
33 Correct 197 ms 16832 KB Output is correct
34 Correct 192 ms 16832 KB Output is correct
35 Correct 263 ms 16832 KB Output is correct
36 Execution timed out 3044 ms 16832 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 3 ms 484 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
6 Correct 3 ms 568 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 3 ms 628 KB Output is correct
11 Correct 3 ms 628 KB Output is correct
12 Correct 2 ms 628 KB Output is correct
13 Correct 3 ms 628 KB Output is correct
14 Correct 3 ms 628 KB Output is correct
15 Correct 3 ms 628 KB Output is correct
16 Correct 5 ms 776 KB Output is correct
17 Correct 5 ms 776 KB Output is correct
18 Correct 5 ms 776 KB Output is correct
19 Correct 12 ms 892 KB Output is correct
20 Correct 13 ms 1020 KB Output is correct
21 Correct 13 ms 1020 KB Output is correct
22 Correct 156 ms 1020 KB Output is correct
23 Correct 148 ms 1020 KB Output is correct
24 Correct 145 ms 1020 KB Output is correct
25 Correct 156 ms 1020 KB Output is correct
26 Correct 166 ms 1020 KB Output is correct
27 Correct 604 ms 16752 KB Output is correct
28 Correct 594 ms 16832 KB Output is correct
29 Correct 518 ms 16832 KB Output is correct
30 Correct 596 ms 16832 KB Output is correct
31 Execution timed out 3066 ms 16832 KB Time limit exceeded
32 Halted 0 ms 0 KB -