結果

問題 No.1529 Constant Lcm
ユーザー chocoruskchocorusk
提出日時 2021-06-04 20:20:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,570 bytes
コンパイル時間 3,593 ms
コンパイル使用メモリ 195,052 KB
実行使用メモリ 188,088 KB
最終ジャッジ日時 2023-08-12 09:11:27
合計ジャッジ時間 19,414 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
52,552 KB
testcase_01 AC 26 ms
52,520 KB
testcase_02 AC 25 ms
52,392 KB
testcase_03 AC 25 ms
52,316 KB
testcase_04 WA -
testcase_05 AC 26 ms
52,380 KB
testcase_06 WA -
testcase_07 AC 25 ms
52,504 KB
testcase_08 WA -
testcase_09 AC 26 ms
52,256 KB
testcase_10 AC 1,192 ms
164,652 KB
testcase_11 AC 439 ms
96,496 KB
testcase_12 AC 34 ms
54,696 KB
testcase_13 WA -
testcase_14 AC 573 ms
107,020 KB
testcase_15 AC 684 ms
118,412 KB
testcase_16 AC 557 ms
108,196 KB
testcase_17 AC 243 ms
79,720 KB
testcase_18 AC 272 ms
82,088 KB
testcase_19 AC 606 ms
112,124 KB
testcase_20 AC 1,421 ms
183,340 KB
testcase_21 AC 1,433 ms
184,376 KB
testcase_22 AC 1,415 ms
180,276 KB
testcase_23 AC 1,544 ms
188,088 KB
testcase_24 AC 1,370 ms
180,152 KB
testcase_25 AC 1,318 ms
171,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using ull=unsigned long long;
using mint=modint998244353;
const int MAX=1000010;
bitset<MAX> isprime;
void sieve(){
    for(int i=3; i<MAX; i++, i++) isprime[i]=1;
    isprime[2]=1;
    for(int i=3; i<MAX; i++){
        if(isprime[i]){
            for(int j=(i<<1); j<MAX; j+=i) isprime[j]=0;
        }
    }
}
map<int, int> mp[1000010];
int mx[1000010];
int main()
{
    int n; cin>>n;
    sieve();
    for(int i=1; i<n; i++){
        if(!isprime[i]) continue;
        for(int j=i; j<n; j+=i){
            int x=j, e=0;
            while(x%i==0){
                e++;
                x/=i;
            }
            if(j<n-j) mp[j][i]+=e;
            else mp[n-j][i]+=e;
        }
    }
    for(int i=1; i<n; i++){
        for(auto p:mp[i]){
            mx[p.first]=max(mx[p.first], p.second);
        }
    }
    mint ans=1;
    for(int i=1; i<n; i++){
        if(!isprime[i]) continue;
        ans*=mint(i).pow(mx[i]);
    }
    cout<<ans.val()<<endl;
    return 0;
}
0