問題一覧 > 通常問題

No.2474 Empty Quartz

レベル : / AI推定難易度 : 1225 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 24
作問者 : SPD_9X2 / テスター : akakimidori りあん tsutaj beet 👑 tute7627 nok0 👑 rin204 だれ momoyuu KKT89
お気に入りにしたユーザー ProblemId : 9828 / 自分の提出
問題文最終更新日: 2023-09-17 19:23:50
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
Japan Alumni Group Summer Camp 2023 Day 2 (順位表) の他の問題:

Problem Statement

$N$ quartz crystals are arranged in a row. However, some of them may be illusions with no physical substance.

For every pair $l,r (1 \le l \le r \le N)$, Jun counted the number of crystals with physical substance from the $l$-th through the $r$-th (closed interval) and recorded its parity.

According to his $\frac{N(N+1)}{2}$ records, there were $K$ intervals containing an odd number of crystals with substance. How many arrangements of the crystals are possible? Find the answer modulo $998244353$.

Here, two arrangements are considered different if there exists some $i$ such that the $i$-th crystal from the left has substance in one arrangement and has no substance in the other.

You are given $T$ instances of the above problem. Answer each of them.

Input

$T$
$N_1\ K_1$
$\vdots$
$N_T\ K_T$

  • All inputs are integers
  • $1 \le T \le 10^5$
  • $1 \le N_i \le 10^5$
  • $0 \le K_i \le \frac{N_i(N_i+1)}{2}$

Output

Print $T$ lines. On the $i$-th line, print the answer to the problem for $N = N_i, K = K_i$.
Print a newline at the end of each line.

Sample

Sample 1
Input
1
3 4
Output
3

Denoting a crystal with substance as 1 and an illusion as 0, the following 3 cases satisfy the condition.

  • $\{0,1,0\}$
  • $\{1,0,1\}$
  • $\{1,1,1\}$

Sample 2
Input
5
5 9
6 10
10 24
10 25
100000 75915540
Output
10
21
165
0
651081880

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。