結果
| 問題 | No.3717 GCD LCM GCD |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-18 22:11:53 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,066 bytes |
| 記録 | |
| コンパイル時間 | 4,090 ms |
| コンパイル使用メモリ | 375,140 KB |
| 実行使用メモリ | 12,928 KB |
| 最終ジャッジ日時 | 2026-09-18 22:12:20 |
| 合計ジャッジ時間 | 6,432 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 1 |
ソースコード
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using P=pair<ll,ll>;
typedef atcoder::modint mint;
ll inf=9e18;
template<typename T, int s, int i = 0>
auto vec(const ll (&sizes)[s], const T& init = T()){
if constexpr(i < s) return vector(sizes[i], vec<T, s, i+1>(sizes, init));
else return init;
}
vector<ll> w;
void dev(ll n){
ll i=1;
while(i*i<=n){
if(n%i==0){
w[i]++;
if(i*i!=n) w[n/i]++;
}
i++;
}
}
int main(){
ll n,k,ans=1;
cin>>n>>k;
// if(k==1){
// ll x;
// ans=1;
// for(ll i=0;i<n;i++){
// cin>>x;
// ans=lcm(ans,x);
// }
// cout<<ans<<"\n";
// return 0;
// }
auto v=vec<ll>({n},0);
w=vector<ll>(1e6+5,0);
for(ll i=0;i<n;i++){
cin>>v[i];
dev(v[i]);
}
// for(ll i=1;i<=100;i++){
// cout<<w[i]<<" ";
// }
// cout<<"\n";
for(ll i=1;i<=1e6;i++){
if(w[i]>=n-n/k+1){
ans=lcm(ans,i);
}
}
cout<<ans<<"\n";
}