結果
| 問題 | No.3717 GCD LCM GCD |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-18 22:00:26 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 624 ms / 2,000 ms |
| + 913µs | |
| コード長 | 1,081 bytes |
| 記録 | |
| コンパイル時間 | 2,331 ms |
| コンパイル使用メモリ | 342,108 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2026-09-18 22:00:38 |
| 合計ジャッジ時間 | 4,875 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 8 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#include<atcoder/modint>
#include<atcoder/lazysegtree>
using namespace atcoder;
using mint=modint998244353;
using namespace std;
using namespace atcoder;
using mint = modint998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll N,K;
cin>>N>>K;
vector<ll> C(1e6+1,0);
map<ll,ll> M;
mint pr=1;
for(int i=0;i<N;i++){
ll A;
cin>>A;
C[A]++;
ll L=A;
for(ll x=2;x*x<=L;x++){
ll e=0;
while(L%x==0){
e++;
L/=x;
}
if(e>0)M[x]=max(M[x],e);
}
if(L!=1)M[L]=max(M[L],1ll);
}
if(K==1){
for(auto [m,e]:M){
pr*=mint(m).pow(e);
}
cout<<pr.val()<<"\n";
return 0;
}
ll cnt=0;
for(int i=0;i<N;i++){
if(i%K!=K-1)cnt++;
}
ll an=1;
for(int a=1;a<=1e6;a++){
ll c=0;
for(int b=a;b<=1e6;b+=a)c+=C[b];
if(c>cnt)an=a;
}
cout<<an<<"\n";
}