# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
898945 | Amirreza_Fakhri | Regions (IOI09_regions) | C++17 | 3928 ms | 95160 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.
// In the name of the God
#include <bits/stdc++.h>
#define ll long long
// #define int long long
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define pii pair <int, int>
#define smin(x, y) (x) = min((x), (y))
#define smax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;
const int inf = 1e9+7;
const int mod = 998244353;
const int maxn = 2e5+5, maxr = 25e3+5, sq = 300, sq_ = 667+2;
int n, q, t = 0, cur = 0, re[maxn], id[maxr], cnt[sq_], res[sq_][maxr], in[maxn], out[maxn];
vector <int> adj[maxn], oc[maxr], amir[maxr];
void dfs(int v = 0) {
in[v] = t++; amir[re[v]].pb(in[v]);
if (oc[re[v]].size() >= sq) cnt[id[re[v]]]++;
for (int i = 0; i < sq_; i++) res[i][re[v]] += cnt[i];
for (int u : adj[v]) dfs(u);
if (oc[re[v]].size() >= sq) cnt[id[re[v]]]--;
out[v] = t;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |