Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
49485 Ryan123 【AB-1】图 C++ 通过 100 155 MS 14044 KB 1013 2022-05-09 13:03:01

Tests(10/10):


#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll Mod=1000000007; ll a[200001]; ll n,m,T; struct Node { ll lson,rson,val; } t[800001]; inline void B(ll l,ll r,ll pos) { t[pos].lson=l,t[pos].rson=r; if(l==r) { t[pos].val=a[l]%Mod; return ; } ll mid=(l+r)>>1; B(l,mid,pos<<1),B(mid+1,r,pos<<1|1); t[pos].val=t[pos<<1].val*t[pos<<1|1].val%Mod; } inline void U(ll x,ll pos) { if(t[pos].lson>x || t[pos].rson<x) return ; if(t[pos].lson==t[pos].rson) { t[pos].val=(t[pos].val+1)%Mod; return ; } ll mid=(t[pos].lson+t[pos].rson)>>1; U(x,pos<<1),U(x,pos<<1|1); t[pos].val=(t[pos<<1].val*t[pos<<1|1].val)%Mod; } signed main() { cin>>n>>m>>T; for(ll i=1,x,y; i<=m; i++) { scanf("%lld%lld",&x,&y); a[y]++; } a[1]=1; B(1,n,1); cout<<t[1].val<<'\n'; for(ll i=1,x,y; i<=T; i++) { scanf("%lld%lld",&x,&y); U(y,1); printf("%lld\n",t[1].val); } return 0; }


测评信息: