Download code/validation/C++/0037534_agc021_b.cpp from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/C%2B%2B/0037534_agc021_b.cpp
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/validation/C++/0037534_agc021_b.cpp
-
curl -L -o 0037534_agc021_b.cpp https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/C%2B%2B/0037534_agc021_b.cpp
1.36 kB
| using namespace std; | |
| typedef long long int ll; | |
| typedef pair<int, int> P; | |
| typedef pair<ll, ll> Pll; | |
| typedef vector<int> Vi; | |
| //typedef tuple<int, int, int> T; | |
| const int dr[4] = {-1, 0, 1, 0}; | |
| const int dc[4] = {0, 1, 0, -1}; | |
| int main() { | |
| // use scanf in CodeForces! | |
| cin.tie(0); | |
| ios_base::sync_with_stdio(false); | |
| int N; cin >> N; | |
| vector<pair<int, int>> points; | |
| REP(i, N) { | |
| int x, y; cin >> x >> y; | |
| points.emplace_back(x, y); | |
| } | |
| vector<int> count(N, 0); | |
| const int n_trial = 1e6; | |
| const double PI = acos(-1); | |
| const double delta = 2 * PI / n_trial; | |
| for (double i = 0; i < 2 * PI; i += delta) { | |
| double x = 1e12 * cos(i), y = 1e12 * sin(i); | |
| //cout << x << ' ' << y << endl; | |
| int idx = 0; | |
| double dist = 1e13; | |
| REP(i, N) { | |
| double a, b; tie(a, b) = points[i]; | |
| double cand = hypot(x - a, y - b); | |
| if (cand < dist) { | |
| dist = cand; | |
| idx = i; | |
| } | |
| } | |
| count[idx]++; | |
| } | |
| //REP(i, N) cout << count[i] << (i == N - 1 ? '\n' : ' '); | |
| cout << setprecision(20); | |
| for (int c : count) cout << 1.0 * c / n_trial << endl; | |
| return 0; | |
| } | |