Submission #402579

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4025792021-05-12 01:58:30faresbasbsFun Tour (APIO20_fun)C++14
0 / 100
6 ms6348 KiB
#include <bits/stdc++.h>
#include "fun.h"
using namespace std;
int n,bad[300001],h[100001];
multiset<int> ms[100001];
void dfs(int curr , int hi){
h[curr] = hi;
ms[curr].insert(hi);
for(int i = 2*curr+1 ; i <= 2*curr+2 ; i += 1){
if(i >= n){
continue;
}
dfs(i,hi+1);
for(auto j : ms[i]){
ms[curr].insert(j);
}
}
}
int solve(int curr){
bad[curr] = 1;
int from = -1 , root = curr;
while(curr && !bad[(curr-1)/2]){
from = curr;
ms[curr].erase(ms[curr].find(h[root]));
curr = (curr-1)/2;
}
ms[curr].erase(ms[curr].find(h[root]));
// cout << curr << endl;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...
#Verdict Execution timeMemoryGrader output
Fetching results...