提交时间:2022-04-11 22:01:31
运行 ID: 48320
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define int long long inline int read(int x=0,bool f=1){ char c=getchar(); while(c>'9'||c<'0'){if(c=='-')f=0;c=getchar();} while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();} return f?x:-x; } int n,m,t,u,v,in[200010],ans=1; int Pow(int x,int y){ int res=1; while(y){ if(y&1) res=res*x%mod; x=x*x%mod; y>>=1; } return res; } signed main(){ n=read(),m=read(),t=read(); while(m--) u=read(),in[v=read()]++; for(int i=2;i<=n;i++) ans=ans*in[i]%mod; printf("%lld\n",ans); for(int i=1;i<=t;i++){ u=read(),v=read(); ans=ans*Pow(in[v],mod-2)%mod*(++in[v])%mod; printf("%lld\n",ans); } return 0; }