제출 #69036

#제출 시각아이디문제언어결과실행 시간메모리
69036imeimi2000Tents (JOI18_tents)C++17
100 / 100
191 ms35912 KiB
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

const int mod = 1e9 + 7;
int dp[3001][3001];

void add(int &x, int y) {
    x = (x + y) % mod;
}

int mul(int x, int y) {
    return (llong)x * y % mod;
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    dp[0][m] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= m; ++j) {
            add(dp[i][j], dp[i - 1][j]);
            if (j < 1) continue;
            add(dp[i][j - 1], mul(dp[i - 1][j], 4 * j));
            if (i < n) add(dp[i + 1][j - 1], mul(dp[i - 1][j], (n - i) * j));
            if (j < 2) continue;
            add(dp[i][j - 2], mul(dp[i - 1][j], j * (j - 1) >> 1));
        }
    }
    int ans = 0;
    for (int i = 0; i < m; ++i) add(ans, dp[n][i]);
    printf("%d\n", ans);
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

tents.cpp: In function 'int main()':
tents.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...