結果

問題 No.1529 Constant Lcm
ユーザー 沙耶花
提出日時 2021-06-04 20:11:24
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 802 bytes
コンパイル時間 17,106 ms
コンパイル使用メモリ 326,232 KB
最終ジャッジ日時 2025-01-21 21:37:06
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 TLE * 2 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

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