QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#64543 | #3083. Bit Operation | hsl2363 | WA | 33ms | 34532kb | C++14 | 1.4kb | 2022-11-24 23:28:22 | 2022-11-24 23:28:23 |
Judging History
answer
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
//#define rg register
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef long long ll;
const int Maxn = 1e6 + 5, Mod = 9982445353;
const double Pi = acos(-1);
typedef ll arr[Maxn];
ll Add(ll x, ll y) { return (x += y) >= Mod ? x - Mod : (x < 0 ? x + Mod : x); }
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
inline ll read()
{
ll res = 0, sign = 1;
char ch = getchar();
while (!isdigit(ch))
{
if (ch == '-')
sign = -1;
ch = getchar();
}
do
{
res = (res << 3) + (res << 1) + (ch ^ 48);
ch = getchar();
} while (isdigit(ch));
return res * sign;
}
int n;
ll ans;
arr a, f, fac, inv, invfac;
ll C(int x, int y) { return fac[x] * invfac[y] % Mod * invfac[x - y] % Mod; }
int main()
{
f[1] = 1;
fac[0] = fac[1] = inv[1] = invfac[0] = invfac[1] = 1;
for (int i = 2; i <= 1000000; i++)
{
f[i] = f[i - 1] * (2 * i - 1) % Mod;
fac[i] = fac[i - 1] * i % Mod;
inv[i] = Mod - Mod / i * inv[Mod % i] % Mod;
invfac[i] = invfac[i - 1] * inv[i] % Mod;
}
cin >> n;
for (int i = 1; i <= n; i++)
if (read())
{
if (i == 1 || i == n)
ans = Add(ans, f[n - 1]);
else
ans = Add(ans, f[i - 1] * f[n - i] % Mod * C(n - 1, i - 1) % Mod);
}
cout << ans << '\n';
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 33ms
memory: 34532kb
input:
999993 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 1 1...
output:
921287004
result:
wrong answer 1st lines differ - expected: '318158140', found: '921287004'