# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
669999 | Iliya | Regions (IOI09_regions) | C++17 | 5426 ms | 84272 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
Lemme check my list of powers and weaknesses:
ability to do anything, but only whenever I want.
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10, R = 3e4, Q = 2e5 + 10, SQ = 499;
int n, r, q, Time, H[N], P[N], St[N], Ft[N], ID[R], cnt[N], Ans[SQ][R];
vector<int> Adj[N], Reg[R], Home[R];
void PreDFS(int v){
St[v] = ++Time;
Reg[H[v]].push_back(Time);
for(int u : Adj[v])
PreDFS(u);
Ft[v] = Time;
}
void DFS(int v){
if((int) Home[H[v]].size() >= SQ) cnt[ID[H[v]]]++;
for(int u : Adj[v]){
for(int i = 1; i < SQ; i++)
Ans[i][H[u]] += cnt[i];
DFS(u);
}
if((int) Home[H[v]].size() >= SQ) cnt[ID[H[v]]]--;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |