답안 #945953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
945953 2024-03-14T09:03:01 Z iaraha 은행 (IZhO14_bank) C++14
0 / 100
1 ms 2904 KB
// Эксперт до 15.04.2024 Насиб
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pf push_front
#define pof pop_front
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define Yes cout << "YES \n"
#define No cout << "NO \n"
#define Ferarri ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
//////////////////// the code below ////////////////////
ll dp[1001][11][(1 << 11)], mod = 1e9 + 7;
signed main(){
    Ferarri
    ll t = 1;
    //cin >> t;
    //cout << setprecision(8) << fixed;
    while (t --) {
        ll n, m;
        cin >> m >> n;
        dp[0][0][0] = 1;
        for (ll i = 0; i < n; i++) {
            for (ll j = 0; j < m; j++) {
                for (ll mask = 0; mask < (1 << m); mask++) {
                    if (mask & (1 << j)) {
                        dp[i][j + 1][mask - (1 << j)] += dp[i][j][mask];
                        dp[i][j + 1][mask - (1 << j)] %= mod;
                    }
                    else {
                        dp[i][j + 1][mask + (1 << j)] += dp[i][j][mask];
                        dp[i][j + 1][mask + (1 << j)] %= mod;
                        if (j + 1 < m && !(mask & (1 << (j + 1)))) {
                            dp[i][j + 1][mask + (1 << (j + 1))] += dp[i][j][mask];
                            dp[i][j + 1][mask + (1 << (j + 1))] %= mod;
                        }
                    }
                }
            }
            for (ll mask = 0; mask < (1 << m); mask++) {
                dp[i + 1][0][mask] = dp[i][m][mask];
            }
        }
        for (ll i = 1; i <= n; i++) {
            cout << dp[i][0][0] << ' ';
        }
        cout << dp[n][0][0];
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -