提交时间:2022-04-11 11:45:12

运行 ID: 48249

#include <bits/stdc++.h> using namespace std; inline long long read() { int x=0,f=1; char t=getchar(); while(t<'0'||t>'9'){if(t=='-')f=0;t=getchar();} while(t>='0'&&t<='9')x=(x<<1)+(x<<3)+(t^48),t=getchar(); return f?x:-x; } const int N=2e5+100,mod=1e9+7; unsigned long long n,m,t,u,v,cntt[N],ans=1,ct[N]; bool bj[N]; vector<int> a[N]; int main() { // freopen("game.in","r",stdin); // freopen("game.out","w",stdout); n=read(),m=read(),t=read(); for(int i=1;i<=m;i++) u=read(),v=read(),a[u].push_back(v),ct[v]++; for(int i=2;i<=n;i++) ans=ans*ct[i]%mod; cout<<ans<<endl; while(t--) { cin>>u>>v; ct[v]++; ans=1; for(int i=2;i<=n;i++) ans=ans*ct[i]%mod; cout<<ans<<endl; } return 0; }