結果
| 問題 |
No.1731 Product of Subsequence
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-11-07 14:37:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 736 ms / 2,000 ms |
| コード長 | 533 bytes |
| コンパイル時間 | 3,829 ms |
| コンパイル使用メモリ | 257,552 KB |
| 最終ジャッジ日時 | 2025-01-25 14:33:37 |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
int main(){
long long N,K;
cin>>N>>K;
map<long long,mint> dp;
dp[1] = 1;
rep(i,N){
long long a;
cin>>a;
map<long long,mint> ndp;
for(auto A:dp){
ndp[gcd(A.first * gcd(a,K),K)] += A.second;
ndp[A.first] += A.second;
}
swap(dp,ndp);
}
dp[1]--;
cout<<dp[K].val()<<endl;
return 0;
}
沙耶花