結果
| 問題 |
No.1529 Constant Lcm
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-04 20:13:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 64 ms / 3,000 ms |
| コード長 | 577 bytes |
| コンパイル時間 | 551 ms |
| コンパイル使用メモリ | 68,372 KB |
| 実行使用メモリ | 12,312 KB |
| 最終ジャッジ日時 | 2024-11-19 08:16:32 |
| 合計ジャッジ時間 | 2,055 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
9 | main()
| ^~~~
ソースコード
#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N;
bool isp[1<<20];
int vis[1<<20];
int cnt[1<<20];
main()
{
cin>>N;
mint ans=1;
for(int i=2;i<N;i++)if(!isp[i])
{
int mx=0;
int t=1;
while(t<=(N-1)/i)
{
t*=i;
for(int j=t;j<N;j+=t)
{
if(vis[j]<i)cnt[j]=0,vis[j]=i;
cnt[j]++;
if(mx<cnt[j])mx=cnt[j];
if(vis[N-j]<i)cnt[N-j]=0,vis[N-j]=i;
cnt[N-j]++;
if(mx<cnt[N-j])mx=cnt[N-j];
}
}
ans*=mint(i).pow(mx);
for(int j=i+i;j<N;j+=i)isp[j]=true;
}
cout<<ans.val()<<endl;
}