問題一覧 > 通常問題

No.1476 esreveR dna esreveR

レベル : / AI推定難易度 : 1300 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 229
作問者 : PCTprobability / テスター : fairy_lettuce nok0 ygussany
お気に入りにしたユーザー ProblemId : 6050 / 自分の提出
問題文最終更新日: 2021-04-11 13:22:08
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
yukicoder contest 291 (順位表) の他の問題:

Problem Statement

There is an $N×N$ matrix. Let $a_{i,j}$ denote the value in row $i$, column $j$ of this matrix.

Initially, $a_{i,i}=1$ for each positive integer $i$ satisfying $1 \le i \le N$. For all other elements, $a_{i,j}=0\ (i \neq j)$.

You may perform the following operations any number of times, $0$ or more, in any order.

  • Choose a positive integer $i$ satisfying $1 \le i \le N$ and reverse row $i$. More formally, for each positive integer $j$ satisfying $1 \le j \le N$, replace $a_{i,j}$ with $a_{i,N-j+1}$.
  • Choose a positive integer $j$ satisfying $1 \le j \le N$ and reverse column $j$. More formally, for each positive integer $i$ satisfying $1 \le i \le N$, replace $a_{i,j}$ with $a_{N-i+1,j}$.

Find the number of matrices that can be obtained in the end.

Since the answer can be very large, find it modulo $998244353$.

Input

$N$

  • All inputs are integers.
  • $1 \le N \le 10^{18}$

Output

Find the number of matrices that can be obtained in the end.

Since the answer can be very large, find it modulo $998244353$.

Sample

Sample 1
Input
2
Output
6

Initially, the matrix is as follows.

1 0
0 1

For $N=2$, every matrix having $2$ each of $0,1$ as elements can be obtained, and no other matrix can be obtained, so print $6$.

For example, by reversing row $1$, the following matrix can be obtained.

0 1
0 1

Sample 2
Input
2021
Output
654946506

Print the answer modulo $998244353$.

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