Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
49087 wsad 【AB-1】图 C++ 解答错误 20 1000 MS 7144 KB 957 2022-04-30 23:16:52

Tests(2/10):


#include<bits/stdc++.h> using namespace std; const int M=1e9+7,N=200003; int a[N]; struct stu{ int l,r,ans; }t[N*4]; void Build(int L,int R,int num){ t[num].l=L,t[num].r=R; if(L==R) { t[num].ans=a[L]; return ; } Build(L,(L+R)/2,num*2); Build((L+R)/2+1,R,num*2+1); t[num].ans=(t[num*2].ans ? t[num*2].ans : 1)*(t[num*2+1].ans? t[num*2+1].ans : 1)%M; return ; } void Change(int x,int num){ if(t[num].l>x || t[num].r<x) return ; if(t[num].l==t[num].r) { ++t[num].ans; return ; } int mid=(t[num].l+t[num].r)/2; if(mid>=x) Change(x,num*2); else Change(x,num*2+1); t[num].ans=(t[num*2].ans? t[num*2].ans : 1)*(t[num*2+1].ans ? t[num*2+1].ans : 1)%M; return ; } int main(){ int n,m,T,x,y,ans=1; cin>>n>>m>>T; while(m--) cin>>x>>y,++a[y]; Build(1,n,1); cout<<t[1].ans<<'\n'; while(T--) { cin>>x>>y; Change(y,1); cout<<t[1].ans<<'\n'; } return 0; }


测评信息: