답안 #995541

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995541 2024-06-09T10:06:34 Z otarius Tents (JOI18_tents) C++17
0 / 100
70 ms 70992 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstring>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

void __print(int x) { cerr << x; }

void __print(long x) { cerr << x; }

void __print(long long x) { cerr << x; }

void __print(unsigned x) { cerr << x; }

void __print(unsigned long x) { cerr << x; }

void __print(unsigned long long x) { cerr << x; }

void __print(float x) { cerr << x; }

void __print(double x) { cerr << x; }

void __print(long double x) { cerr << x; }

void __print(char x) { cerr << '\'' << x << '\''; }

void __print(const char *x) { cerr << '\"' << x << '\"'; }

void __print(const string &x) { cerr << '\"' << x << '\"'; }

void __print(bool x) { cerr << (x ? "true" : "false"); }

template<typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}

template<typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i: x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}

void _print() { cerr << "]\n"; }

template<typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair <int, int>
#define ull unsigned long long

// #define int long long
// #define int unsigned long long

const ll mod = 1e9 + 7;
const ll weirdMod = 998244353;
const int maxN = 1e5 + 25;

ll dp[3005][3005];
void solve() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= 3000; i++)
        dp[i][0] = dp[0][i] = 1;
    for (int i = 1; i <= 3000; i++) {
        for (int j = 1; j <= 3000; j++) {
            dp[i][j] += dp[i - 1][j];
            dp[i][j] += dp[i - 1][j - 1] * 4 * j;
            if (j >= 2) dp[i][j] += dp[i - 1][j - 2] * j * (j - 1) / 2;
            if (i >= 2) dp[i][j] += dp[i - 2][j - 1] * (i - 1) * j;
            dp[i][j] %= mod;
        }
    }
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        cout << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 70992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 70992 KB Output isn't correct
2 Halted 0 ms 0 KB -