为什么一直TLE??
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 5e6+10, mod = 998244353;
LL fact[N], infact[N];
int qmi(LL a, int k, int p)
{
int res = 1;
while (k)
{
if (k & 1) res = (LL)res * a % p;
a = (LL)a * a % p;
k >>= 1;
}
return res;
}
int main()
{
int n,m;
scanf("%d%d", &n,&m);
fact[0] = infact[0] = 1;
for (int i = 1; i <=m; i ++ )
{
fact[i] = (LL)fact[i - 1] * i % mod;
infact[i] = (LL)infact[i - 1] * qmi(i, mod - 2, mod) % mod;
}
LL sum=0;
while (n -- )
{
int a, b;
scanf("%d%d", &a, &b);
sum=sum^((LL)fact[a] * infact[b] % mod * infact[a - b] % mod);
}
cout<<sum<<endl;
return 0;
}