QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#572958 | #9310. Permutation Counting 4 | 1457 | WA | 0ms | 3584kb | C++14 | 1.3kb | 2024-09-18 16:56:07 | 2024-09-18 16:56:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define NO cout<<"No"<<endl
#define YES cout<<"Yes"<<endl
#define all(a) a.begin(),a.end()
#define endl '\n'
#define pb push_back
#define mo 1000000007
#define MO 998244353
const int N = 2e5+1;
const int M = 2e3+1;
const ll maxn = 1e6+10, mod = 1e9+7;
ll Jc[maxn];
void calJc() //求maxn以内的数的阶乘
{
Jc[0] = Jc[1] = 1;
for(ll i = 2; i < maxn; i++)
Jc[i] = Jc[i - 1] * i % mod;
}
void exgcd(ll a, ll b, ll &x, ll &y) //拓展欧几里得算法
{
if(!b) x = 1, y = 0;
else
{
exgcd(b, a % b, y, x);
y -= x * (a / b);
}
}
ll niYuan(ll a) //求a对b取模的逆元
{
ll x, y;
exgcd(a, mod, x, y);
return (x + mod) % mod;
}
ll C(ll n, ll r) //计算C(n, r)
{
return Jc[n] * niYuan(Jc[r]) % mod
* niYuan(Jc[n - r]) % mod;
}
ll A(ll n, ll r)
{
return Jc[n] * niYuan(Jc[n-r])%mod;
}
void solve()
{
int n,ans=0;
cin>>n;
for(int i=1;i<=n;i++)
{
int l,r;
cin>>l>>r;
if((r-l+1)>=n)
{
ans+=A((r-l+1),n);
}
}
cout<<ans%2<<endl;
}
signed main()
{
int _=1;
cin>>_;
while(_--)
{
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
4 5 1 2 1 5 1 2 1 2 2 2 5 1 1 2 4 2 3 5 5 3 4 5 3 5 1 2 3 4 3 5 3 3 5 1 5 1 4 4 5 5 5 1 2
output:
0 0 0 0
result:
wrong answer 2nd words differ - expected: '1', found: '0'