結果
| 問題 | No.1731 Product of Subsequence |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-11-07 14:37:04 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 538 ms / 2,000 ms |
| コード長 | 533 bytes |
| 記録 | |
| コンパイル時間 | 4,121 ms |
| コンパイル使用メモリ | 281,216 KB |
| 実行使用メモリ | 7,968 KB |
| 最終ジャッジ日時 | 2026-06-23 15:44:53 |
| 合計ジャッジ時間 | 9,080 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
沙耶花