# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
793499 | phoebe | Regions (IOI09_regions) | C++17 | 4872 ms | 79304 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 <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("03")
// #define int long long
#define ll long long
#define pii pair<int, int>
#define F first
#define S second
#define PB push_back
#define ALL(x) x.begin(), x.end()
#define FOR(i, n) for (int i = 0; i < n; i++)
#define NYOOM ios::sync_with_stdio(0); cin.tie(0);
// #define endl '\n'
const int INF = 1e9 + 7;
const ll LLINF = 1ll<<60;
const int maxn = 2e5 + 10, block = 400, maxr = 25005;
int n, r, q, h[maxn], arrive[maxn], leave[maxn],
cnt[maxn / block][maxr] = {0}, // cnt[i][j] = # region i as manager of j
timer = 0, cur[block] = {0}, get_idx[maxn], idx = 0;
vector<int> adj[maxn], bruh[maxr], // bruh[i] = vector of arrive time of region i
region[maxr]; // region[i] = vector of all nodes in region i
void dfs(int v){ // O(n sqrt n)
arrive[v] = timer++;
bruh[h[v]].PB(arrive[v]);
FOR(i, maxn / block) cnt[i][h[v]] += cur[i];
if (get_idx[h[v]] != -1) cur[get_idx[h[v]]]++;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |