結果

問題 No.2045 Two Reflections
ユーザー chineristACchineristAC
提出日時 2022-08-19 22:53:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,149 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 74,880 KB
最終ジャッジ日時 2024-04-17 01:31:24
合計ジャッジ時間 2,736 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
64,896 KB
testcase_01 AC 48 ms
64,896 KB
testcase_02 AC 58 ms
71,808 KB
testcase_03 AC 62 ms
72,448 KB
testcase_04 AC 67 ms
74,368 KB
testcase_05 AC 60 ms
72,320 KB
testcase_06 AC 58 ms
71,552 KB
testcase_07 AC 63 ms
72,448 KB
testcase_08 AC 74 ms
74,880 KB
testcase_09 AC 70 ms
74,112 KB
testcase_10 AC 68 ms
73,344 KB
testcase_11 AC 61 ms
72,704 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 45 ms
65,152 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 57 ms
71,040 KB
testcase_21 AC 59 ms
71,808 KB
testcase_22 AC 59 ms
71,936 KB
testcase_23 AC 59 ms
72,192 KB
testcase_24 AC 64 ms
72,192 KB
testcase_25 AC 67 ms
71,680 KB
testcase_26 AC 60 ms
71,936 KB
testcase_27 AC 61 ms
71,808 KB
testcase_28 AC 59 ms
71,808 KB
testcase_29 AC 58 ms
71,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush
from itertools import cycle, permutations
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

spf = [i for i in range(10**5+1)]
for p in range(2,10**5+1):
    if spf[p]==p:
        for n in range(p,10**5+1,p):
            spf[n] = p


mod = 998244353

N,p,q = mi()

P = [i for i in range(N)]
for i in range(p//2):
    P[i],P[p-1-i] = P[p-1-i],P[i]


for i in range(q//2):
    P[-i-1],P[-(q-1-i)-1] = P[-(q-1-i)-1],P[-i-1]

LCM = [0] * (N+1)
visit = [False] * N
for i in range(N):
    if visit[i]:
        continue
    n = 1
    pos = P[i]
    visit[i] = True
    while pos!=i:
        visit[pos] = True
        n += 1
        pos = P[pos]

    tmp = n
    while tmp!=1:
        p = spf[tmp]
        k = 0
        while tmp%p==0:
            k += 1
            tmp //= p
        LCM[p] = max(LCM[p],k)

res = 1
for p in range(2,N+1):
    if spf[p]==p:
        res *= pow(p,LCM[p],998244353)
        res %= 998244353

print((res*2) % 998244353)





0