# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
487294 | Joo | Bitaro’s Party (JOI18_bitaro) | C++17 | 943 ms | 167648 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>
#define DEBUG false
using namespace std;
const int N = 1e5+10, BS = 200, INF = 1e9;
using pi = pair<int,int>;
int n,m,Q, sz[N], dis[N][BS], node[N][BS], tv[BS], tn[BS];
vector<int> bl, G[N];
bool ban[N];
void preprocess(){
for(int u = 1; u <= n; u++){
if(sz[u] < BS){
dis[u][sz[u]] = 0;
node[u][sz[u]] = u;
sz[u]++;
}
for(int v : G[u]){ //propagate current max to its child
int i = 0, j = 0, k = 0; //perform alike merge sort
while(i < sz[u] and j < sz[v] and k < BS){
if(dis[u][i] + 1 > dis[v][j]){
if(!ban[node[u][i]]){
tv[k] = dis[u][i] + 1;
tn[k] = node[u][i];
ban[node[u][i]] = true;
k++;
}
i++;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |