結果
| 問題 | No.1529 Constant Lcm |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-06-04 20:11:24 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1,630 ms / 3,000 ms |
| コード長 | 802 bytes |
| 記録 | |
| コンパイル時間 | 2,865 ms |
| コンパイル使用メモリ | 270,524 KB |
| 実行使用メモリ | 501,888 KB |
| 最終ジャッジ日時 | 2026-06-20 18:01:05 |
| 合計ジャッジ時間 | 20,539 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#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;
}
沙耶花