結果
問題 |
No.1529 Constant Lcm
|
ユーザー |
|
提出日時 | 2021-06-04 20:12:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 577 bytes |
コンパイル時間 | 796 ms |
コンパイル使用メモリ | 67,896 KB |
実行使用メモリ | 12,404 KB |
最終ジャッジ日時 | 2024-11-19 08:14:15 |
合計ジャッジ時間 | 2,517 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 15 |
コンパイルメッセージ
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+=i) { 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; }