#include #include #include #include #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,tree-vectorize") #pragma GCC target("popcnt,mmx,sse,sse2,sse3,sse4.1,sse4.2,avx,tune=native") using namespace __gnu_pbds; using namespace std; #define endl "\n" #define mp make_pair #define st first #define nd second #define pii pair #define pb push_back #define _upgrade ios_base::sync_with_stdio(0), cout.setf(ios::fixed), cout.precision(10), cin.tie(0), cout.tie(0); #define rep(i, n) for (int i = 0; i < (n); ++i) #define fwd(i, a, b) for (int i = (a); i < (b); ++i) #define trav(a, x) for (auto &a : x) #define all(c) (c).begin(), (c).end() #define sz(X) (int)((X).size()) typedef long double ld; typedef unsigned long long ull; typedef long long ll; typedef tree, rb_tree_tag, tree_order_statistics_node_update> indexed_set; // find_by_order(x) <-returns x-th element order_of_key(x) <- returns order of element x // mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());uniform_int_distribution distr(0, 1e9);auto my_rand = bind(distr, gen); // my_rand() zwraca teraz liczbe z przedzialu [a, b] #ifdef LOCAL ostream &operator<<(ostream &out, string str) { for (char c : str) out << c; return out; } template ostream &operator<<(ostream &out, pair p) { return out << "(" << p.st << ", " << p.nd << ")"; } template ostream &operator<<(ostream &out, tuple p) { auto &[a, b, c] = p; return out << "(" << a << ", " << b << ", " << c << ")"; } template auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) { out << '{'; for (auto it = a.begin(); it != a.end(); it = next(it)) out << (it != a.begin() ? ", " : "") << *it; return out << '}'; } void dump() { cerr << "\n"; } template void dump(T a, Ts... x) { cerr << a << ", "; dump(x...); } #define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__) #else #define debug(...) 42 #endif #define int long long const int mod = 167772161; const int MAXN = 405; int tab[MAXN][MAXN]; void clear() { rep(i, MAXN) rep(j, MAXN) tab[i][j] = 0; } vector get(vector &W, int k, int w) { debug(W, k, w); clear(); tab[0][0] = 1; int n = sz(W); rep(i, n) { if (i % 30 == 0) { rep(i, n + 1) rep(j, k + 1) tab[i][j] %= mod; } int w = W[i]; for (int j = i + 1; j > 0; j--) for (int l = k; l >= w; l--) tab[j][l] += tab[j - 1][l - w]; } vector res; for (int j = 1; j <= n; j++) { int x = 0; for (int i = k; i > k - w; i--) x += tab[j][i]; res.push_back(x % mod); } return res; } int32_t main() { _upgrade; int n, k; cin >> n >> k; // n = MAXN - 2; // k = MAXN - 2; vector W(n); // rep(i, n) W[i] = 1; rep(i, n) cin >> W[i]; rep(i, n) { vector X; rep(j, n) if (i != j) X.push_back(W[j]); auto res = get(X, k, W[i]); for (int x : res) cout << x << " "; cout << endl; } }