結果

問題 No.1771 A DELETEQ
ユーザー WizistWizist
提出日時 2021-12-05 00:47:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,530 ms / 3,500 ms
コード長 816 bytes
コンパイル時間 1,459 ms
コンパイル使用メモリ 167,788 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-21 13:09:42
合計ジャッジ時間 61,103 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,228 KB
testcase_01 AC 1 ms
8,628 KB
testcase_02 AC 2,528 ms
7,680 KB
testcase_03 AC 2 ms
7,768 KB
testcase_04 AC 2,530 ms
7,896 KB
testcase_05 AC 2,508 ms
8,756 KB
testcase_06 AC 2 ms
8,032 KB
testcase_07 AC 2 ms
7,760 KB
testcase_08 AC 1 ms
8,076 KB
testcase_09 AC 91 ms
7,876 KB
testcase_10 AC 136 ms
7,972 KB
testcase_11 AC 150 ms
7,700 KB
testcase_12 AC 160 ms
8,756 KB
testcase_13 AC 94 ms
7,648 KB
testcase_14 AC 562 ms
8,192 KB
testcase_15 AC 683 ms
8,756 KB
testcase_16 AC 1,156 ms
8,216 KB
testcase_17 AC 8 ms
8,756 KB
testcase_18 AC 80 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 377 ms
4,376 KB
testcase_21 AC 20 ms
4,376 KB
testcase_22 AC 200 ms
4,376 KB
testcase_23 AC 198 ms
4,380 KB
testcase_24 AC 43 ms
4,376 KB
testcase_25 AC 22 ms
4,384 KB
testcase_26 AC 289 ms
4,376 KB
testcase_27 AC 64 ms
4,376 KB
testcase_28 AC 16 ms
4,380 KB
evil_hand_1.txt TLE -
evil_hand_2.txt AC 1 ms
4,376 KB
evil_hand_3.txt AC 1 ms
4,376 KB
evil_random_1.txt TLE -
evil_random_2.txt TLE -
evil_random_3.txt TLE -
evil_random_4.txt TLE -
evil_random_5.txt TLE -
evil_random_6.txt TLE -
evil_random_7.txt TLE -
evil_random_8.txt TLE -
evil_random_9.txt TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.1771 A DELETEQ
#include <bits/stdc++.h>

using namespace std;

#define	MOD	998244353

int main(int argc, char *argv[])
{
	auto mpow = [&](long long x, long long n) {
		long long r = 1;
		for ( ; n > 0; x = x * x % MOD, n >>= 1) if (n & 1) r = r * x % MOD;
		return r;
	};

	long long x, y;
	cin >> x >> y;
	if (x > y) swap(x, y);
	vector<long long> p(x + 1, 1);
	for (int i = 1; i <= x; i++) p[i] = p[i - 1] * 2 % MOD;
	long long ans = 0;
	for (int k = 0; k <= x; k++) {
		long long n = x + y - k - k, t = 1, r = 1, m = 1;
		for (int j = 0; j < x - k; j++)
			m = m * (n - j) % MOD * mpow(j + 1, MOD - 2) % MOD;
		for (int j = 1; j <= k; j++) {
			t = t * (n + j) % MOD * mpow(j, MOD - 2) % MOD;
			r = (r + t * p[j] % MOD) % MOD;
		}
		ans = (ans + r * m % MOD) % MOD;
	}

	cout << ans << endl;

	return 0;
}
0