# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337104 | jhnah917 | Synchronization (JOI13_synchronization) | C++14 | 121 ms | 11136 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 x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
using namespace std;
typedef long long ll;
struct Node{
Node *l, *r, *p; int val;
Node() : Node(1) {}
Node(int val) : l(nullptr), r(nullptr), p(nullptr), val(val) {}
bool IsLeft() const { return this == p->l; }
bool IsRoot() const { return !p || (p->l != this && p->r != this); }
void Rotate(){
if(IsRoot()) return;
if(IsLeft()){
if(r) r->p = p; p->l = r; r = p;
}
else{
if(l) l->p = p; p->r = l; l = p;
}
if(!p->IsRoot()) (p->IsLeft() ? p->p->l : p->p->r) = this;
auto t = p; p = t->p; t->p = this;
}
};
void Splay(Node *x){
for(; !x->IsRoot(); x->Rotate()){
if(!x->p->IsRoot()){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |