QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#64543#3083. Bit Operationhsl2363WA 33ms34532kbC++141.4kb2022-11-24 23:28:222022-11-24 23:28:23

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-24 23:28:23]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:34532kb
  • [2022-11-24 23:28:22]
  • 提交

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'