제출 #947433

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9474332024-03-16 07:13:39weakweakweakCapital City (JOI20_capital_city)C++17
30 / 100
180 ms94932 KiB
//
#include <bits/stdc++.h>
using namespace std;
int lt[510000], rt[510000], cnt[510000], n, k, col[510000], revlt[510000], now = 0, l[510000], r[510000];
int pos[510000] = {0};
vector<int> e[510000];
vector<int> qs[510000];
set<int> st[510000];
int a[510000] = {0};
void update (int i, int val) {
for (; i <= n; i += i & -i) a[i] += val;
}
int query (int i) {
int res = 0;
for (; i > 0; i -= i & -i) res += a[i];
return res;
}
int query2 (int l, int r) {return query(r) - query(l - 1);}
void dfs (int i, int par) {
lt[i] = ++now, revlt[now] = i;
for (int j : e[i]) if (j != par) dfs(j, i);
rt[i] = now;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...