# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
478216 | Abrar_Al_Samit | Regions (IOI09_regions) | C++17 | 4994 ms | 34708 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.
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
const int MX = 200005;
const int B = 447;
int N, R, Q;
vector <int> g[MX], region[MX];
int H[MX], st[MX], en[MX], stwho[MX];
int idx[MX], timer=1;
long long prep[B][25001];
void Flat(int v, int p) {
stwho[timer] = v;
st[v] = timer++;
region[H[v]].push_back(st[v]);
for(auto to : g[v]) if(to!=p) {
Flat(to, v);
}
en[v] = timer-1;
}
void DFS(int v, int p, int reg, int cnt) {
if(H[v]==reg) ++cnt;
else prep[idx[reg]][H[v]] += cnt;
for(auto u : g[v]) if(u!=p) {
DFS(u, v, reg, cnt);
}
}
int main() {
cin >> N >> R >> Q;
cin >> H[1];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |