国宴!

来自我校六年级选手!虽然我知道尊重,但真的很好笑

#include <bits/stdc++.h>
using namespace std;
struct node {
    int ez[2];//儿子
    int sjz, sz, zhi;//随机值,size(少有正常的),值
} treap[1000010];
int len/*最新结点的下标*/, n, r11, r22;//分离后的左子树和右子树
void updown(int x) {//上下
    if (x)
        treap[x].sz = treap[treap[x].ez[1]].sz + treap[treap[x].ez[0]].sz + 1;
}
void fenli/*分离*/(int ww/*蜗蜗*/, int &zg/*左根*/, int &yg/*右根*/, int shu/*数*/) {
    if (ww == 0)
        zg = yg = 0;
    else if (treap[ww].zhi <= shu)
        zg = ww, fenli(treap[ww].ez[1], treap[zg].ez[1], yg, shu);
    else
        yg = ww, fenli(treap[ww].ez[0], zg, treap[yg].ez[0], shu);
    updown(ww);
}
void hebing/*合并*/(int &ww, int zg, int yg) {
    if (zg == 0 || yg == 0)
        ww = zg + yg;
    else if (treap[zg].sjz >= treap[yg].sjz)
        ww = yg, hebing(treap[ww].ez[0], zg, treap[ww].ez[0]);
    else
        ww = zg, hebing(treap[ww].ez[1], treap[ww].ez[1], yg);
    updown(ww);
}
void internet/*封神段,请反复诵读,体验情感*/(int &r/*根*/, int x) {
    fenli(r, r11, r22, x);
    treap[++len].zhi = x;
    treap[len].sjz = rand();
    treap[len].sz = 1;
    r = len;
    hebing(r11, r11, len);
    hebing(r, r11, r22);
}
void shanc/*删除*/(int &r, int x) {
    int z = 0;
    fenli(r, r11, r22, x);
    fenli(r11, r11, z, x - 1);
    hebing(z, treap[z].ez[0], treap[z].ez[1]);
    hebing(r, r11, z);
    hebing(r, r, r22);
}
int gettrk/*得到t排名*/(int r, int x) {
    if (r == 0)
        return 1;
    if (x > treap[r].zhi)
        return 1 + treap[treap[r].ez[0]].sz + gettrk(treap[r].ez[1], x);
    else
        return gettrk(treap[r].ez[0], x);
}
int pm/*排名(pm2.5)*/(int r, int x) {
    if (treap[treap[r].ez[0]].sz >= x)
        return pm(treap[r].ez[0], x);
    else if (treap[treap[r].ez[0]].sz + 1 >= x)
        return treap[r].zhi;
    else
        return pm(treap[r].ez[1], x - treap[treap[r].ez[0]].sz - 1);
}
int qian/*钱*/(int r, int x) {
    if (r == 0)
        return -1000000000;
    if (treap[r].zhi >= x)
        return qian(treap[r].ez[0], x);
    else
        return max(treap[r].zhi, qian(treap[r].ez[1], x));
}
int hou/*猴*/(int r, int x) {
    if (r == 0)
        return 1000000000;
    if (treap[r].zhi <= x)
        return hou(treap[r].ez[1], x);
    else
        return min(treap[r].zhi, hou(treap[r].ez[0], x));
}
int main() {
    srand(time(0));
    int ww = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        int bj/*北京欢迎你*/, x;
        scanf("%d%d", &bj, &x);
        if (bj == 1)
            internet(ww, x);
        if (bj == 2)
            shanc(ww, x);
        if (bj == 3)
            printf("%d\n", gettrk(ww, x));
        if (bj == 4)
            printf("%d\n", pm(ww, x));
        if (bj == 5)
            printf("%d\n", qian(ww, x));
        if (bj == 6)
            printf("%d\n", hou(ww, x));
    }
    return 0;
}

变量不规范,同学笑出两行泪