Submission #28185892
Source Code Expand
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,k,n) for (int i = (k); i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
// using P = pair<ll,ll>;
const ll INF = (ll)1e18;
// const int INF = (int)1e9+7;
// const int MOD = (int)1e9+7;
// const ll MOD = (int)1e9+7;
template<typename T>
void chmin(T &a, T b) { a = min(a, b); }
template<typename T>
void chmax(T &a, T b) { a = max(a, b); }
template<typename T>
void print(vector<T> v) {
int n = v.size();
rep(i,n) {
if (i == 0) cout << v[i];
else cout << ' ' << v[i];
}
cout << endl;
}
ll N, X;
vector<vector<ll>> a;
int ans = 0;
void dfs(int depth, ll prod) {
if (depth == N) {
if (prod == X) ans++;
return;
}
for (ll x : a[depth]) {
// X < x*prod
if (X / prod < x) continue;
dfs(depth+1, prod*x);
}
}
void solve() {
cin >> N >> X;
a.resize(N);
rep(i,N) {
int L;
cin >> L;
a[i].resize(L);
rep(j,L) cin >> a[i][j];
}
dfs(0, 1);
cout << ans << endl;
}
int main() {
solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Product |
| User | goropikari |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 1307 Byte |
| Status | AC |
| Exec Time | 33 ms |
| Memory | 3588 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt, example2.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, example0.txt, example1.txt, example2.txt, killer001.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 7 ms | 3484 KiB |
| 001.txt | AC | 2 ms | 3388 KiB |
| 002.txt | AC | 2 ms | 3576 KiB |
| 003.txt | AC | 6 ms | 3572 KiB |
| 004.txt | AC | 7 ms | 3584 KiB |
| 005.txt | AC | 6 ms | 3356 KiB |
| 006.txt | AC | 11 ms | 3552 KiB |
| 007.txt | AC | 33 ms | 3452 KiB |
| 008.txt | AC | 2 ms | 3448 KiB |
| 009.txt | AC | 2 ms | 3452 KiB |
| 010.txt | AC | 2 ms | 3404 KiB |
| 011.txt | AC | 2 ms | 3588 KiB |
| 012.txt | AC | 2 ms | 3452 KiB |
| 013.txt | AC | 2 ms | 3540 KiB |
| 014.txt | AC | 3 ms | 3340 KiB |
| 015.txt | AC | 7 ms | 3456 KiB |
| 016.txt | AC | 2 ms | 3584 KiB |
| 017.txt | AC | 3 ms | 3404 KiB |
| example0.txt | AC | 2 ms | 3396 KiB |
| example1.txt | AC | 3 ms | 3480 KiB |
| example2.txt | AC | 2 ms | 3560 KiB |
| killer001.txt | AC | 2 ms | 3540 KiB |