# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445398 | apostoldaniel854 | Fountain Parks (IOI21_parks) | C++17 | 686 ms | 56712 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "parks.h"
#include <map>
#include <algorithm>
#include <iostream>
const int MAX_N = 2e5;
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
int dxb[] = {-1, -1, 1, 1};
int dyb[] = {-1, 1, -1, 1};
bool used[1 + MAX_N];
std::map <std::pair <int, int>, int> fountains;
int nr;
void dfs (int node, std::vector <int> &x, std::vector <int> &y) {
used[node] = true;
++nr;
for (int dir = 0; dir < 4; dir++) {
int nx = x[node] + 2 * dx[dir];
int ny = y[node] + 2 * dy[dir];
if (fountains.count ({nx, ny})) {
int vec = fountains[{nx, ny}];
if (not used[vec])
dfs (vec, x, y);
}
}
}
int construct_roads(std::vector<int> x, std::vector<int> y) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |