結果

問題 No.1476 esreveR dna esreveR
ユーザー 8nd5t8nd5t
提出日時 2021-04-16 20:26:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 1,522 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 86,672 KB
実行使用メモリ 71,536 KB
最終ジャッジ日時 2023-09-15 21:13:07
合計ジャッジ時間 1,989 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,308 KB
testcase_01 AC 97 ms
71,308 KB
testcase_02 AC 96 ms
71,532 KB
testcase_03 AC 97 ms
71,244 KB
testcase_04 AC 92 ms
71,312 KB
testcase_05 AC 94 ms
71,512 KB
testcase_06 AC 97 ms
71,536 KB
testcase_07 AC 97 ms
71,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,math,itertools
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right 
from heapq import heappop,heappush,heapify
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split()))
def inps(): return sys.stdin.readline()
def inpsl(x): tmp = sys.stdin.readline(); return list(tmp[:x])
def err(x): print(x); exit()

class Combination:
    """
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=998244353):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv
mod = 998244353
n = inp()
N = n*n%mod
res = pow(6,n//2,mod)
print(res%mod)
0