結果
問題 | No.1396 Giri |
ユーザー | 沙耶花 |
提出日時 | 2021-02-14 21:26:02 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 451 ms / 2,000 ms |
コード長 | 840 bytes |
コンパイル時間 | 2,046 ms |
コンパイル使用メモリ | 207,756 KB |
実行使用メモリ | 10,672 KB |
最終ジャッジ日時 | 2023-09-29 14:29:10 |
合計ジャッジ時間 | 6,477 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 434 ms
10,560 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 438 ms
10,564 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 1 ms
4,500 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,376 KB |
testcase_16 | AC | 2 ms
4,380 KB |
testcase_17 | AC | 4 ms
4,376 KB |
testcase_18 | AC | 29 ms
4,380 KB |
testcase_19 | AC | 215 ms
6,976 KB |
testcase_20 | AC | 306 ms
8,568 KB |
testcase_21 | AC | 384 ms
9,868 KB |
testcase_22 | AC | 430 ms
10,480 KB |
testcase_23 | AC | 451 ms
10,672 KB |
testcase_24 | AC | 440 ms
10,568 KB |
testcase_25 | AC | 441 ms
10,668 KB |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/modint> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 1000000001 int main(){ int N; cin>>N; vector<int> P(N+1,-1); for(int i=2;i<=N;i++){ if(P[i]!=-1)continue; for(int j=i;j<=N;j+=i){ P[j] = i; } } bool f = true; map<int,int> mp; for(int i=N;i>=2;i--){ if(P[i]==i){ if(f){ f=false; continue; } } map<int,int> p; int x = i; while(x!=1){ p[P[x]]++; x /= P[x]; } for(auto a:p){ 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; }