存档
officeyutong
2017-12-20 13:16:37
/\*
\* To change this license header, choose License Headers in Project Properties.
\* To change this template file, choose Tools | Templates
\* and open the template in the editor.
\*/
/\*
\* File: main.cpp
\* Author: Ytong
\*
\* Created on 2017年11月10日, 下午2:54
\*/
#p\
r\
a\
g\
m\
```cpp
a GCC optimize("O3")
#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <algorithm>
#include <set>
#include <string>
//#define DEBUG
using namespace std;
using int_t = long long int;
const int_t LARGE = 200000;
const int_t INF = 0x7ffffff;
struct Node {
Node* leftChd = nullptr;
Node* rightChd = nullptr;
int_t val = 0;
int_t size = 0;
void maintain() {
size = 1;
if (leftChd) {
size += leftChd->size;
}
if (rightChd) {
size += rightChd->size;
}
}
int_t leftSize() {
if (leftChd) {
return leftChd->size;
} else {
return 0;
}
}
};
//node的右子节点绕node左旋
void leftRotate(Node*& node) {
Node* temp = node->rightChd;
node->rightChd = temp->leftChd;
temp->leftChd = node;
node->maintain();
temp->maintain();
node = temp;
}
//node的左子节点绕node右旋
void rightRotate(Node*& node) {
Node* temp = node->leftChd;
node->leftChd = temp->rightChd;
temp->rightChd = node;
node->maintain();
temp->maintain();
node = temp;
}
//将以node为根的子树中第k大的元素旋转到node
void splay(Node*& node, int_t k) {
}
int main(int argc, char** argv) {
ios::sync_with_stdio(false);
return 0;
}
```