海亮日寄2.0

day -inf

回大连再写

算了,开写

听说期末考试补考了,于是停课在410写bytoj

笑死,停课一周写了bytoj的1/4

一大早六点半从家里出发去赶飞机,顺便在机场吃了早饭

大家都没来,东方幻想eclipse启动!需要更新???pubg启动!账号寄了??

我***************************************************************************************************

很好,飞机晚点半小时,于是在机场傻站着

终于到了hl,没有收手机,于是开新号玩游戏,爽!

day1 构造题专练

[正睿集训2021] 构造专练 - C202044zxy - 博客园 (cnblogs.com)

原题都在这里了

t1

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%2==0)
	{
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	for(int i=0;i<n;i++)
	{
		cout<<i<<endl;
	} 
	for(int i=0;i<n;i++)
	{
		cout<<i<<endl;
	}
	for(int i=0;i<n;i++)
	{
		cout<<2*i%n<<endl;
	}
	return 0;
} 

t2

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    n=pow(2,n)-1;
    int sum=n*(n-1)/6;
    cout<<sum<<endl;
    for(int i=1;i<=n;i++)
    {
        for(int j=1+i;j<=n;j++)
        {
            int k=0 xor i xor j;
            if(k>j)
            {
                cout<<k<<" "<<i<<" "<<j<<endl;
            }
        }
    }
    return 0;
}

t3 最恶心的一集

#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>q[11451];
int n;
int main()
{
    cin>>n;
    for(int i=0;i<2*n-1;i++)
    {
        for(int j=i+1;j<2*n-1;j++)
        {
            q[(i+j)%(2*n-1)].push_back(make_pair(i,j));
        }
    }
    for(int i=0;i<2*n-1;i++)
    {
        q[2*i%(2*n-1)].push_back(make_pair(i,2*n-1));
    }
    for(int i=0;i<2*n-1;i++)
    {
        for(auto ans:q[i])
        {
            cout<<ans.first+1<<" "<<ans.second+1<<endl;
        }
    }
    return 0;
}

注意上述代码不开o2过不了

t4

#include<bits/stdc++.h>
using namespace std;
const int maxn = 2020;
int per[maxn],st[maxn],top;
int n;
std::set<int> s[maxn];
inline int adde(int x,int y){
    if(s[x].count(y)||s[y].count(x))return 1;
    s[x].insert(y),s[y].insert(x);
    return 0;
}
char buf[(int)1e8],*vout=buf;
inline void pc(int x){*vout++=x;}
inline void put(int x){
    if(x>9)put(x/10);
    pc(x%10+48);
}
int main(){
    scanf("%d",&n);
    put(n/2),pc(10);
    for(int i=1;i<=n;i+=2)per[i]=++top;
    top=n;
    for(int i=2;i<=n;i+=2)per[i]=top--;
    for(int i=1;i<=n/2;++i){
        for(int j=1;j<n;++j){
            put(per[j]),pc(' '),put(per[j+1]),pc(' ');
        }
        for(int i=1;i<=n;++i)++per[i]==n+1?per[i]=1:0;
        pc(10);
    }
    fwrite(buf,vout-buf,1,stdout);
}

不知道为啥,hloj没法交cf的题,索性交洛谷

_________________________________________________________可爱的分割线_______________________________________________________________________________________

连自己想+看题解+问别人终于写了十道题,1k pts

来之前我洛谷只AC了7道紫题

今天一晚上写了4紫+1黑

由于紫题之前做过一些,所以索性说一下那个黑题

传送门:Rectangular Polyline - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)

其实这道题好像数学上向量的基底分解

只需要用背包维护存在|𝑎𝑖|=𝑙𝑖,|𝑏𝑖|=𝑝𝑖且ai=bi=0,其中i∈[1,n]

woc,快九点了

直接上代码

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1005;
bitset<maxn*maxn>f[maxn];
int t,n,m,a[maxn],b[maxn];
inline cal(int *a)
{
    int m=0;
    for(int i=1;i<=n;i++)
    {
        m+=a[i];
    }
    if(m&1)
    {
        return 0;
    }
    m>>=1;
    for(int i=1;i<=n;i++)
    {
        f[i]=((f[i-1])|(f[i-1]<<a[i]));
    }
    if(!f[n][m])
    {
        return 0;
    }
    for(int i=n;i;i--)
    {
        if(!f[i-1][m])
        {
            m-=a[i];
            a[i]=-a[i];
        }
    }
    return 1;
}
int main()
{
    f[0][0]=1;
    cin>>t;
    while(t--)
    {
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        cin>>m;
        for(int i=1;i<=m;i++)
        {
            cin>>b[i];
        }
        if((n!=m) or (!cal(a)) or (!cal(b)))
        {
            cout<<"NO"<<endl;
            continue;
        }
        int cnt=0;
        for(int i=1;i<=n;i++)
        {
            cnt+=(a[i]<0)-(b[i]<0);
        }
        if(cnt<0)
        {
            for(int i=1;i<=n;i++)
            {
                a[i]=-a[i];
                b[i]=-b[i];
            }
        }
        sort(a+1,a+1+n),reverse(a+1,a+1+n);
        sort(b+1,b+1+n),reverse(b+1,b+1+n);
        for(int i=1;i<=n+1;i++)
        {
            if((i>n) or (a[i]<0))
            {
                reverse(b+1,b+i);
                break;
            }
        }
        for(int i=n;i>=0;i--)
        {
            if((!i) or (b[i]>0))
            {
                reverse(a+i+1,a+1+n);
                break;
            }
        }
        cout<<"YES"<<endl;
        for(int i=1,x=0,y=0;i<=n;i++)
        {
            x+=a[i];
            cout<<x<<" "<<y<<endl;
            y+=b[i];
            cout<<x<<" "<<y<<endl;            
        }
    }
    return 0;
}

 day2

上午模拟赛,全是remote judge题,结果codeforces崩了(估计现在毛子们在睡觉,服务器下线维护了)

前两题煞笔题目,20分钟拿下

t3,好像可以参照转换二进制写法,对k取模之后进行计算(k进制数最大为k--),但是注意要有qpow,否则日爆

#include<bits/stdc++.h>
using namespace std;
const int maxn = 114;
const int inf = 1e6;
typedef long long ll;
ll t,n,k,cnt,a[maxn],vis[maxn],fac[maxn];
int main()
{
    cin>>t;
    while(t--)
    {
        memset(vis,0,sizeof(vis));
        cin>>n>>k;
        fac[0]=1;
        for(int i=1;fac[i-1]<inf;i++)
        {
            fac[i]=fac[i-1]*k;
            cnt=i;
        }
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        for(int i=1;i<=n;i++)
        {
            int p=0;
            while(a[i])
            {
                vis[p]+=a[i]%k;
                a[i]/=k;
                p++;
            }
        }
        bool flag=false;
        for(int i=0;i<=cnt;i++)
        {
            if(vis[i]>1)
            {
                flag=true;
            }
        }
        if(flag)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            cout<<"YES"<<endl;
        }
    }
    return 0;
}

t4

智商正常的应该都能看出来相等的一组数肯定在最大值的两边,那么可以将除了最大值外的所有数分在最大值的两边

然而至少有三个数才可以进行上述操作,加个特判就完事了

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
inline ll read()
{
   int x=0,f=1;
   char ch=getchar();
   while(ch<'0'||ch>'9')
   {
       if(ch=='-')
           f=-1;
       ch=getchar();
   }
   while(ch>='0' && ch<='9')
       x=x*10+ch-'0',ch=getchar();
   return x*f;
}
inline ll ksm(ll a,ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)
        {
            res=res*a%mod;
        }
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
ll ans=1,res=1;
int main()
{
    int n=read(),m=read();
    if(n==2)
    {
        cout<<0<<endl;
        return 0;
    }
    for(int i=1;i<=m;i++)
    {
        ans=ans*i%mod;
    }
    for(int i=1;i<=n-1;i++)
    {
        res=res*i%mod;
    }
    for(int i=1;i<=m-n+1;i++)
    {
        res=res*i%mod;
    }
    ans=((ans*ksm(res,mod-2)%mod)*(n-2)%mod)*ksm(2,n-3)%mod;
    cout<<ans<<endl;
    return 0;
}

t5

区间dp大水题

只需要找到[l,r]长度和区间和的特殊情况,就可以结束了

#include<bits/stdc++.h>
using namespace std;
const int maxn = 505;
int a[maxn],n,dp[maxn][maxn];
int sum[maxn][maxn];
//sum qujianhe
//dp qujianchangdu min
int main()
{
    memset(dp,1e6,sizeof(dp));
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        dp[i][i]=1;
        sum[i][i]=a[i];
    }
    for(int k=2;k<=n;k++)
    {
        for(int l=1;l+k-1<=n;l++)
        {
            int r=l+k-1;
            for(int mid=l;mid<r;mid++)
            {
                dp[l][r]=min(dp[l][r],dp[l][mid]+dp[mid+1][r]);
                if(sum[l][mid]==sum[mid+1][r] and dp[l][mid]==1 and dp[l][mid]==dp[mid+1][r])
                {
                    dp[l][r]=1;
                    sum[l][r]=sum[l][mid]+1;
                }
            }
        }
    }
    cout<<dp[1][n]<<endl;
    return 0;
}

t5写完就剩10分钟了,索性开摆

就是说今天cf怎么推出oi赛制了

中午回寝室,累的厉害,于是躺在床上探讨哲学问题和恋爱心理

就是说hl的床,上铺翻身的时候下面跟坐船一样,晃得厉害,俗称《有推背感》

day3

说在前面,考试前不要眼瞎,看清楚是标准输入输出还是文件读写,这神操作导致我33pts-—>0pts

警钟撅烂

题目挺难,考完瞬间想退役了

 

但是听完讲解感觉自己又行了(“很难不想到”)

不细说了,离谱

day4

上午团建,累死,下午回寝室玩到4点半。

听说要学平衡树了,于是预习,还有亲手调了一个小时才写完的splay板子,直到发现把-inf写成了inf,自己脑补精神状态

 

#include<bits/stdc++.h>
#define root tree[0].ch[1]
#define inf 1000000005
using namespace std;
inline int read()
{
    register int x=0,f=1;register char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return x*f;
}
struct Splay{
    int fa,ch[2],v,sum,rec;
}tree[50005];
int tot=0;
inline bool findd(register int x)
{
    return x==tree[tree[x].fa].ch[0]?0:1;
}
inline void connect(register int x,register int fa,register int son)
{
    tree[x].fa=fa;
    tree[fa].ch[son]=x;
}
inline void update(register int x)
{
    tree[x].sum=tree[tree[x].ch[0]].sum+tree[tree[x].ch[1]].sum+tree[x].rec;
}
inline void rotate(register int x)
{
    int Y=tree[x].fa;
    int R=tree[Y].fa;
    int Yson=findd(x);
    int Rson=findd(Y);
    int B=tree[x].ch[Yson^1];
    connect(B,Y,Yson);
    connect(Y,x,Yson^1);
    connect(x,R,Rson);
    update(Y),update(x);
}
inline void splay(register int x,register int to)
{
    to=tree[to].fa;
    while(tree[x].fa!=to)
    {
        int y=tree[x].fa;
        if(tree[y].fa==to)
            rotate(x);
        else if(findd(x)==findd(y))
            rotate(y),rotate(x);
        else
            rotate(x),rotate(x);
    }
}
inline int newpoint(register int v,register int fa)
{
    tree[++tot].v=v;
    tree[tot].fa=fa;
    tree[tot].sum=tree[tot].rec=1;
    return tot;
}
inline void Insert(register int x)
{
    int now=root;
    if(root==0)
    {
        newpoint(x,0);
        root=tot;
    }
    else
    {
        while(1)
        {
            ++tree[now].sum;
            if(x==tree[now].v)
            {
                ++tree[now].rec;
                splay(now,root);
                return;
            }
            int nxt=x<tree[now].v?0:1;
            if(!tree[now].ch[nxt])
            {
                int p=newpoint(x,now);
                tree[now].ch[nxt]=p;
                splay(p,root);
                return;
            }
            now=tree[now].ch[nxt];
        }
    }
}
inline int find(register int x)
{
    int now=root;
    while(1)
    {
        if(x==tree[now].v)
        {
            splay(now,root);
            return now;
        }
        int nxt=x<tree[now].v?0:1;
        if(!tree[now].ch[nxt])
            return 0;
        now=tree[now].ch[nxt];
    }
}
inline void delet(register int x)
{
    int pos=find(x);
    if(!pos)
        return;
    if(tree[pos].rec>1)
    {
        --tree[pos].rec;
        --tree[pos].sum;
    }
    else
    {
        if(!tree[pos].ch[0]&&!tree[pos].ch[1])
            root=0;
        else if(!tree[pos].ch[0])
        {
            root=tree[pos].ch[1];
            tree[root].fa=0;
        }
        else
        {
            int left=tree[pos].ch[0];
            while(tree[left].ch[1])
                left=tree[left].ch[1];
            splay(left,tree[pos].ch[0]);
            connect(tree[pos].ch[1],left,1);
            connect(left,0,1);
            update(left);
        }
    }
}
inline int lower(register int v)
{
    int now=root,ans=-inf;
    while(now)
    {
        if(tree[now].v<v&&tree[now].v>ans)
            ans=tree[now].v;
        if(tree[now].v>v)
            now=tree[now].ch[0];
        else
            now=tree[now].ch[1];
    }
    return ans;
}
inline int upper(register int v)
{
    int now=root,ans=inf;
    while(now)
    {
        if(tree[now].v>v&&tree[now].v<ans)
            ans=tree[now].v;
        if(tree[now].v>v)
            now=tree[now].ch[0];
        else
            now=tree[now].ch[1];
    }
    return ans;
}
bool vis[50005];
int stac[50005],top=-1;
int main()
{
    memset(vis,false,sizeof(vis));
    int n=read(),m=read();
    Insert(0);
    Insert(n+1);
    while(m--)
    {
        char ch=getchar();
        while(ch!='D'&&ch!='R'&&ch!='Q')
            ch=getchar();
        if(ch=='D')
        {
            int x=read();
            vis[x]=true;
            stac[++top]=x;
            Insert(x);
        }
        else if(ch=='R')
        {
            vis[stac[top]]=false;
            delet(stac[top--]);
        }
        else
        {
            int x=read();
            if(vis[x])
                puts("0");
            else
            {
            cout<<(upper(x)-lower(x)-1)<<endl;
            }
        }
    }
    return 0;
}
View Code

 

day5

rfy限时返场讲课,平衡树?!

听FDsama等已经肝过金牌导航的神犇们说平衡树极其的简单

听完后我的评价是

简单个**

引用一下化竞大佬zyw的名言:“退竞!!!!!!!!!!!!!!!!!!!!”

我也是终于明白一道题写两个小时200 lines+结果写挂了是什么感觉了

但是有一说一,为什么rfy给的题好像没有一道题必须用平衡树?

A.luogu p3165

#include<bits/stdc++.h>
using  namespace std;
const int maxn = 1e5+5;
struct node
{
    int i,k;
}a[maxn];
inline int read()
{
    register int x=0,f=1;register char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return x*f;
}
int n,fa[maxn],siz[maxn],ch[maxn][2],root,tag[maxn];
inline bool cmp(node a,node b)
{
    if(a.k<b.k)
    {
        return 1;
    }
    if(a.k==b.k)
    {
        return a.i<b.i;
    }
    return 0;
}
inline void update(int x)
{
    siz[x]=siz[ch[x][0]]+siz[ch[x][1]]+1;
}
inline void build(int l,int r,int f)
{
    if(l>r)
    {
        return;
    }
    int mid=(l+r)>>1;
    if(mid<f)
    {
        ch[f][0]=mid;
    }
    else ch[f][1]=mid;
    siz[mid]=1;
    fa[mid]=f;
    if(l==r)
    {
        return;
    }
    build(l,mid-1,mid);
    build(mid+1,r,mid);
    update(mid);
}
inline void down(int k)
{
    tag[k]^=1;
    if(ch[k][0])
    {
        tag[ch[k][0]]^=1;
    }
    if(ch[k][1])
    {
        tag[ch[k][1]]^=1;
    }
    swap(ch[k][1],ch[k][0]);
}
inline void roate(int x,int &goal)
{
    int y=fa[x],z=fa[y],k=ch[y][1]==x;
    if(y==goal)
    {
        goal=x;
    }
    else
    {
        ch[z][ch[z][1]==y]=x;
    }
    ch[y][k]=ch[x][k^1];
    ch[x][k^1]=y;
    fa[y]=x;
    fa[x]=z;
    fa[ch[y][k]]=y;
    update(y);
}
inline void splay(int x,int &goal)
{
    while(x!=goal)
    {
        int y=fa[x],z=fa[y];
        if(tag[z])
        {
            down(z);
        }
        if(tag[y])
        {
            down(y);
        }
        if(tag[x])
        {
            down(x);
        }
        if(y!=goal)
        {
            if(ch[y][1]==x^ch[z][1]==y)
            {
                roate(x,goal);
            }
            else
            {
                roate(y,goal);
            }
        }
        roate(x,goal);
        update(x);
    }
}
inline int find(int now,int k)
{
    if(tag[now])
    {
        down(now);
    }
    int l=ch[now][0],r=ch[now][1];
    if(siz[l]+1==k)
    {
        return now;
    }
    if(k<=siz[l])
    {
        return find(l,k);
    }
    return find(r,k-siz[l]-1);
}
inline void reverse(int l,int r)
{
    int x=find(root,l-1),y=find(root,r+1);
    splay(x,root);
    splay(y,ch[x][1]);
    tag[ch[y][0]]^=1;
}
int main()
{
    n=read();
    for(int i=1;i<=n;i++)
    {
        a[i+1].k=read();
        a[i+1].i=i+1;
    }
    a[1].i=1;
    a[n+2].i=n+2;
    a[n+2].k=2000000001;
    sort(a+1,a+3+n,cmp);
    build(1,n+2,0);
    root=n+3>>1;
    int p;
    for(int i=2;i<=n;i++)
    {
        splay(a[i].i,root);
        p=siz[ch[root][0]]+1;
        cout<<p-1<<" ";
        reverse(i,p);
    }
    cout<<n<<endl;
    return 0;
}
View Code

B.cf702f treap树板子题(代码有亮点)

  1 #include<bits/stdc++.h>
  2 using namespace std;
  3 #define ls(x) tr[x].l
  4 #define rs(x) tr[x].r
  5 inline int read()
  6 {
  7     int x=0,f=1;char ch=getchar();
  8     while(ch<'0'||ch>'9'){
  9         if(ch=='-')
 10             f=-1;
 11         ch=getchar();
 12     }
 13     while(ch>='0'&&ch<='9')
 14         x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
 15     return x*f;
 16 }
 17 const int maxn = 2e5+5;
 18 struct treap
 19 {
 20     int siz,val,sum,w;
 21     int l,r;
 22     int lazy,sub;
 23 }tr[maxn];
 24 int root,cnt,a,b,c;
 25 inline int add(int k)
 26 {
 27     tr[++cnt].val=k;
 28     tr[cnt].w=rand();
 29     tr[cnt].siz=1;
 30     tr[cnt].l=tr[cnt].r=tr[cnt].sum=tr[cnt].lazy=tr[cnt].sub=0;
 31     return cnt;
 32 }
 33 inline void pushup(int x)
 34 {
 35     tr[x].siz=tr[ls(x)].siz+tr[rs(x)].siz+1;
 36 }
 37 inline void pushdown(int x)
 38 {
 39     if(tr[x].lazy)
 40     {
 41         if(ls(x))
 42         {
 43             tr[ls(x)].lazy+=tr[x].lazy;
 44             tr[ls(x)].sum+=tr[x].lazy;
 45         }
 46         if(rs(x))
 47         {
 48             tr[rs(x)].lazy+=tr[x].lazy;
 49             tr[rs(x)].sum+=tr[x].lazy;
 50         }
 51         tr[x].lazy=0;
 52     }
 53     if(tr[x].sub)
 54     {
 55         if(ls(x))
 56         {
 57             tr[ls(x)].sub+=tr[x].sub;
 58             tr[ls(x)].val-=tr[x].sub;
 59         }
 60         if(rs(x))
 61         {
 62             tr[rs(x)].sub+=tr[x].sub;
 63             tr[rs(x)].val-=tr[x].sub;
 64         }
 65         tr[x].sub=0;
 66     }
 67 }
 68 inline void splitval(int x,int k,int &a,int &b)
 69 {
 70     if(!x)
 71     {
 72         return a=b=0,void();
 73     }
 74     pushdown(x);
 75     if(k>=tr[x].val)
 76     {
 77         a=x;
 78         splitval(rs(x),k,rs(x),b);
 79     }
 80     else
 81     {
 82         b=x;
 83         splitval(ls(x),k,a,ls(x));
 84     }
 85     pushup(x);
 86 }
 87 inline void splitsiz(int x,int k,int &a,int &b)
 88 {
 89     if(!x)
 90     {
 91         return a=b=0,void();
 92     }
 93     pushdown(x);
 94     if(k>=tr[ls(x)].siz+1)
 95     {
 96         a=x;
 97         splitsiz(rs(x),k-tr[ls(x)].siz-1,rs(x),b);
 98     }
 99     else
100     {
101         b=x;
102         splitsiz(ls(x),k,a,ls(x));
103     }
104     pushup(x);
105 }
106 inline int merge(int x,int y)
107 {
108     if(!x or !y)
109     {
110         return x|y;
111     }
112     pushdown(x);
113     pushup(x);
114     pushdown(y);
115     pushup(y);
116     if(tr[x].w<tr[y].w)
117     {
118         rs(x)=merge(rs(x),y);
119         return pushup(x),x;
120     }
121     else
122     {
123         ls(y)=merge(x,ls(y));
124         return pushup(y),y;
125     }
126 }
127 inline void ins(int k)
128 {
129     int a,b;
130     splitval(root,k,a,b);
131     root=merge(merge(a,add(k)),b);
132 }
133 inline void update(int x)
134 {
135     if(!x)
136     {
137         return;
138     }
139     pushdown(x);
140     update(ls(x));
141     update(rs(x));
142 }
143 /******************************
144 treap-tree    juejueviki617
145 ******************************/
146 
147 int n,m;
148 struct node
149 {
150     int c,q;
151     bool operator<(const node &b) const
152     {
153         if(q!=b.q)
154         {
155             return q>b.q;
156         }
157         else
158         {
159             return c<b.c;
160         }
161     }
162 }p[maxn];
163 int v[maxn];
164 queue<int> q;
165 inline void build(int &r1,int r2,int x)
166 {
167     int a,b;
168     while(!q.empty())
169     {
170         q.pop();
171     }
172     q.push(r2);
173     while(!q.empty())
174     {
175         int tmp=q.front();
176         q.pop();
177         pushdown(tmp);
178         if(ls(tmp))
179         {
180             q.push(ls(tmp));
181         }
182         if(rs(tmp))
183         {
184             q.push(rs(tmp));
185         }
186         splitval(r1,tr[tmp].val-p[x].c,a,b);
187         ls(tmp)=rs(tmp)=tr[tmp].lazy=tr[tmp].sub=0;
188         tr[tmp].val-=p[x].c;
189         tr[tmp].siz=1;
190         tr[tmp].sum++;
191         r1=merge(merge(a,tmp),b);
192     }
193 }
194 inline void work(int x)
195 {
196     int a,b,c;
197     splitval(root,p[x].c-1,a,b);
198     splitval(b,(p[x].c<<1)-1,b,c);
199     tr[c].sub+=p[x].c;
200     tr[c].val-=p[x].c;
201     tr[c].sum++;
202     tr[c].lazy++;
203     build(a,b,x);
204     root=merge(a,c);
205 }
206 int main()
207 {
208     n=read();
209     for(int i=1;i<=n;i++)
210     {
211         p[i].c=read();
212         p[i].q=read();
213     }
214     sort(p+1,p+1+n);
215     m=read();
216     for(int i=1;i<=m;i++)
217     {
218         int x=read();
219         ins(x);
220     }
221     for(int i=1;i<=n;i++)
222     {
223         work(i);
224     }
225     update(root);
226     for(int i=1;i<=m;i++)
227     {
228         cout<<tr[i].sum<<" ";
229     }
230     return 0;
231 }
View Code

后续不写了,因为t6我没写,其他的因为被平衡树折磨地索性不用了qwq

 /*

在这里特别说几句,部分人学竞赛成绩还挺好的,但是你有什么资本仗着自己成绩好在机房发癫,觉得自己光荣吗?

我想问一句,你是没有母本,无性生殖的产物吗????

长的跟朱元璋似的还真以为自己能诛别人九族吗

忘了,这种人本身就没有九族

说谁谁知道,自己想对号入座我也不拦着

*/

day6

今天发生啥了?

好像就是在补题

不写了

但是部分煞笔每天恶心我好几回就不地道了吧

 

但是我好奇一件事,这是谁干的

 

posted @ 2024-06-27 14:16  类人群星闪耀时  阅读(24)  评论(1编辑  收藏  举报