結果

問題 No.2045 Two Reflections
ユーザー okkuukenkenokkuukenken
提出日時 2022-08-19 22:21:34
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,191 bytes
コンパイル時間 1,888 ms
コンパイル使用メモリ 164,872 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 01:01:46
合計ジャッジ時間 3,146 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<random>
#include<bitset>
#include<cassert>
#include<complex>
#include<fstream>
#include<cstdlib>
#include<functional>
using namespace std;
typedef long long ll;
const int mod=998244353;
const int dx[]={1,0,0,-1},dy[]={0,1,-1,0};
ll mypow(int x,ll n){
	if(n==0)
		return 1;
	if(n%2==1)
		return mypow(x,n-1)*x%mod;
	ll res=mypow(x,n/2);
	return res*res%mod;
}
int arr[100000];
bool used[100000];
int main(){
	int n,p,q;
	cin>>n>>p>>q;
	if(p==1&&q==1)
		cout<<1<<endl,exit(0);
	if(p==1||q==1)
		cout<<2<<endl,exit(0);
	iota(arr,arr+n,0);
	reverse(arr,arr+p);
	reverse(arr+n-q,arr+n);
	map<int,int>fact;
	for(int i=0;i<n;i++){
		if(used[i])
			continue;
		int cnt=0;
		for(int j=i;!used[j];j=arr[j],cnt++)
			used[j]=1;
		cout<<cnt<<endl;
		for(int j=2;j<=cnt;j++){
			int tmp=0;
			while(cnt%j==0){
				tmp++;
				cnt/=j;
			}
			fact[j]=max(fact[j],tmp);
		}
	}
	int ans=1;
	for(auto x:fact)
		ans=ans*mypow(x.first,x.second)%mod;
	cout<<ans*2%mod<<endl;
}
0