# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
69968 | vanogam | Zalmoxis (BOI18_zalmoxis) | C++14 | 727 ms | 99548 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>
using namespace std;
int a,s,d[1000002],f,g,h,j,k,l,i,n,m;
struct tre{
int val;
tre *L;
tre *R;
tre(){
L=NULL;
R=NULL;
val=0;
}
};
tre *root;
void bld(tre *&it,int lv){
it=new tre();
if(!it->L && !it->R && lv==d[a]) {it->val=1;a++;return;}
if(lv>d[a]) bld(it->L,lv-1);
if(a==n) {if(!it->R) h++;return;}
if(it->L && lv>d[a]) return bld(it->R,lv-1);
if(!it->R) h++;
}
void fnd(tre *&it,int lv){
if(it->val) {cout<<lv<<" ";return;}
if(!it->L) {
if(h==k || lv==0) {cout<<lv<<" ";return;}
h++;
it->L=new tre();
it->R=new tre();
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |