Submission #104103

# Submission time Handle Problem Language Result Execution time Memory
104103 2019-04-04T03:25:18 Z dimash241 Circle selection (APIO18_circle_selection) C++17
7 / 100
3000 ms 15068 KB
# include <stdio.h>
# include <bits/stdc++.h>
 
 
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (int i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (int i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red
 
using namespace std;
inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; } 
inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}
 
const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;
 
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int u[N];
struct cir {
	int x, y, r, id;
 
	bool operator < (const cir &b) const {
		return r > b.r || (r == b.r && id < b.id);
	}
}w[N];
ll dist (ll x, ll y, ll x1, ll y1) {
	return (x - x1) * (ll)(x - x1) + (y - y1) * (ll)(y - y1);
}
int main () {
	SpeedForce;               
    cin >> n;
    for (int i = 1; i <= n; i ++) {
    	cin >> w[i].x >> w[i].y >> w[i].r;
    	w[i].id = i;
    }
    sort(w + 1, w + n + 1);
 
    for (int i = 1; i <= n; i ++) {
    	if (u[w[i].id]) continue;
    	for (int j = i + 1; j <= n; j ++) {
    		if (!u[w[j].id] && dist(w[i].x, w[i].y, w[j].x, w[j].y) <= (w[i].r + w[j].r) * (ll)(w[i].r + w[j].r)) {
    			u[w[j].id] = w[i].id;
    		
    		}
    	}
    	u[w[i].id] = w[i].id;
    }
    for (int i = 1; i <= n; i ++)
    	cout << u[i] << ' ';
 
    return Accepted;
}
 
// B...a D....
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 7 ms 640 KB Output is correct
20 Correct 6 ms 640 KB Output is correct
21 Correct 7 ms 640 KB Output is correct
22 Correct 32 ms 640 KB Output is correct
23 Correct 33 ms 632 KB Output is correct
24 Correct 38 ms 512 KB Output is correct
25 Correct 30 ms 632 KB Output is correct
26 Correct 46 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 176 ms 8432 KB Output is correct
2 Correct 174 ms 14940 KB Output is correct
3 Correct 169 ms 14840 KB Output is correct
4 Correct 156 ms 15068 KB Output is correct
5 Execution timed out 3029 ms 11000 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Execution timed out 3008 ms 5004 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3018 ms 5356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 7 ms 640 KB Output is correct
20 Correct 6 ms 640 KB Output is correct
21 Correct 7 ms 640 KB Output is correct
22 Correct 32 ms 640 KB Output is correct
23 Correct 33 ms 632 KB Output is correct
24 Correct 38 ms 512 KB Output is correct
25 Correct 30 ms 632 KB Output is correct
26 Correct 46 ms 508 KB Output is correct
27 Correct 10 ms 896 KB Output is correct
28 Correct 8 ms 896 KB Output is correct
29 Correct 8 ms 1024 KB Output is correct
30 Correct 126 ms 888 KB Output is correct
31 Correct 113 ms 768 KB Output is correct
32 Correct 130 ms 860 KB Output is correct
33 Correct 64 ms 5988 KB Output is correct
34 Correct 64 ms 5980 KB Output is correct
35 Correct 59 ms 5752 KB Output is correct
36 Execution timed out 3021 ms 4984 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 7 ms 640 KB Output is correct
20 Correct 6 ms 640 KB Output is correct
21 Correct 7 ms 640 KB Output is correct
22 Correct 32 ms 640 KB Output is correct
23 Correct 33 ms 632 KB Output is correct
24 Correct 38 ms 512 KB Output is correct
25 Correct 30 ms 632 KB Output is correct
26 Correct 46 ms 508 KB Output is correct
27 Correct 176 ms 8432 KB Output is correct
28 Correct 174 ms 14940 KB Output is correct
29 Correct 169 ms 14840 KB Output is correct
30 Correct 156 ms 15068 KB Output is correct
31 Execution timed out 3029 ms 11000 KB Time limit exceeded
32 Halted 0 ms 0 KB -