MSBOP 2015 Round3 register

Ended

Participants:978

Verdict:AC | TLE
Submitted:2015-05-09 16:11:57

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <string.h>
#include <math.h>
#define N 100
#define M 100
#define PI 3.1415926
int active[N];
int visit[N];
int n, m, g, p, l;
int tower[N][2];
int city[M][2];
double dis2(int x1, int y1, int x2, int y2) {
    double dx = x2 - x1;
    double dy = y2 - y1;
    return dx * dx + dy * dy;
}
double theta(int i, int j, int c) {
    double l1 = dis2(tower[i][0], tower[i][1], city[c][0], city[c][1]);
    double l2 = dis2(tower[j][0], tower[j][1], city[c][0], city[c][1]);
    double l3 = dis2(tower[i][0], tower[i][1], tower[j][0], tower[j][1]);
    double cost = (l1 + l2 - l3) / (2 * sqrt(l1 * l2));
    return acos(cost);
}
bool in(int i, int j, int k, int c) {
    double t1 = theta(i, j, c);
    double t2 = theta(i, k, c);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX