QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#233264 | #7662. Kaldorian Knights | ValenciaTravis# | WA | 1ms | 5728kb | C++20 | 614b | 2023-10-31 15:52:29 | 2023-10-31 15:52:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define MAXN 1000005
#define ll long long
const ll mod = 1e9 + 7;
ll n, m, fac[MAXN], k[MAXN];
int main(){
cin>>n>>m;
fac[0] = 1;
for(int i=1;i<=n;i++) fac[i] = fac[i-1] * i % mod;
ll ans = fac[n];
for(int i=1;i<=m;i++) scanf("%lld", &k[i]), k[i] += k[i-1];
ans -= fac[n-k[1]] * fac[k[1]] % mod;
ans %= mod;
for(int i=2;i<=m;i++) {
ans -= fac[n-k[i]] * (fac[k[i]] - fac[k[i]-k[i-1]] * fac[k[i-1]] % mod) % mod;
ans %= mod;
}
ans = (ans % mod + mod) % mod;
cout<<ans<<endl;
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5728kb
input:
3 0
output:
0
result:
wrong answer 1st lines differ - expected: '6', found: '0'