답안 #810954

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
810954 2023-08-06T18:10:15 Z vjudge1 Tents (JOI18_tents) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

int32_t main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        int n, m;
        cin >> n >> m;
        const int MOD = 1e9 + 7;
        vector<vector<int64_t>> f(n + 1, vector<int64_t>(m + 1, 1));
        for (int i = 1; i <= n; i++) {
                for (int j = 0; j <= m; j++) {
                        f[i][j] = f[i - 1][j];
                        if (j > 0) (f[i][j] += f[i - 1][j - 1] * j * 4) %= MOD;
                        if (i > 1) (f[i][j] += f[i - 2][j - 1] * (i - 1) * j) %= MOD;
                        if (j > 1) (f[i][j] += f[i - 1][j - 2] * j * (j - 1) / 2) % MOD;
                }
        }
        cout << (f[n][m] + MOD - 1) % MOD;
}

Compilation message

tents.cpp: In function 'int32_t main()':
tents.cpp:16:83: warning: value computed is not used [-Wunused-value]
   16 |                         if (j > 1) (f[i][j] += f[i - 1][j - 2] * j * (j - 1) / 2) % MOD;
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -