結果
問題 | No.2045 Two Reflections |
ユーザー |
![]() |
提出日時 | 2023-05-11 18:35:00 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 226 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 16,384 KB |
最終ジャッジ日時 | 2024-11-27 15:18:39 |
合計ジャッジ時間 | 2,810 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
import sys readline=sys.stdin.readline import math def LCM(a,b): return a*b//math.gcd(a,b) N,P,Q=map(int,readline().split()) lst=[i for i in range(N)] lst[:P]=lst[:P][::-1] lst[-Q:]=lst[-Q:][::-1] ans=1 mod=998244353 seen=[False]*N for i in range(N): if seen[i]: continue cnt=0 while not seen[i]: seen[i]=True cnt+=1 i=lst[i] ans=LCM(ans,cnt) if 2<=P and 2<=Q: ans*=2 ans%=mod print(ans)