結果

問題 No.1529 Constant Lcm
ユーザー 沙耶花沙耶花
提出日時 2021-06-04 20:11:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,946 ms / 3,000 ms
コード長 802 bytes
コンパイル時間 4,434 ms
コンパイル使用メモリ 269,288 KB
実行使用メモリ 501,968 KB
最終ジャッジ日時 2023-08-12 08:49:17
合計ジャッジ時間 25,019 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2,664 ms
434,608 KB
testcase_11 AC 904 ms
171,296 KB
testcase_12 AC 30 ms
11,828 KB
testcase_13 AC 2,153 ms
373,908 KB
testcase_14 AC 1,263 ms
224,452 KB
testcase_15 AC 1,431 ms
253,736 KB
testcase_16 AC 1,088 ms
206,588 KB
testcase_17 AC 553 ms
107,916 KB
testcase_18 AC 602 ms
116,820 KB
testcase_19 AC 1,359 ms
237,976 KB
testcase_20 AC 2,946 ms
492,616 KB
testcase_21 AC 2,883 ms
494,692 KB
testcase_22 AC 2,886 ms
485,864 KB
testcase_23 AC 2,944 ms
501,968 KB
testcase_24 AC 2,928 ms
486,176 KB
testcase_25 AC 2,808 ms
468,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int main(){
	int N;
	cin>>N;
	
	vector<map<int,int>> mp(N);
	
	for(int i=2;i<N;i++){
		if(mp[i].size()!=0)continue;
		long long t = 1;
		while(true){
			t *= i;
			if(t >= N)break;
			for(int j=t;j<N;j+=t){
				mp[j][i]++;
			}
		}
	}
	
	vector<map<int,int>> mp2 = mp;
	for(int i=1;i<N;i++){
		int t = N-i;
		for(auto a:mp[t]){
			mp2[i][a.first] += a.second;
		}
	}
	
	map<int,int> Mp;
	
	rep(i,N){
		for(auto a:mp2[i]){
			Mp[a.first] = max(Mp[a.first],a.second);
		}
	}
	
	mint ans = 1;
	for(auto a:Mp){
		ans *= mint(a.first).pow(a.second);
	}
	
	cout<<ans.val()<<endl;
	
	return 0;
}
0