# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37338 | IvanC | Deda (COCI17_deda) | C++14 | 336 ms | 5188 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;
const int INF = 1e9 + 1;
typedef struct node* pnode;
struct node{
pnode l,r;
int key,puro,junta,prior;
node(int _key,int _puro) : l(NULL),r(NULL),key(_key),puro(_puro),junta(_puro),prior(rand() ^ (rand() << 16)){}
};
inline int jnt(pnode t){return t ? t->junta : INF;}
inline void update(pnode t){if(t) t->junta = min(min(jnt(t->l),t->puro),jnt(t->r));}
void split(pnode t,int key,pnode &l,pnode &r){
if(t == NULL){
l = r = NULL;
}
else if(key < t->key){
split(t->l,key,l,t->l);
r = t;
}
else{
split(t->r,key,t->r,r);
l = t;
}
update(t);
}
void merge(pnode &t,pnode l,pnode r){
if(l == NULL){
t = r;
}
else if(r == NULL){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |