Submission #2370001
Source Code Expand
#include <bits/stdc++.h> using namespace std; constexpr int mod = 1e9 + 7; int dp[334][334][334]; int main() { int n, m; cin >> n >> m; dp[0][n - 1][1] = 1; for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { for (int k = 1; k <= n; ++k) { (dp[i + 1][j][n - j] += 1ll * k * dp[i][j][k] % mod) %= mod; (dp[i + 1][j - 1][k] += 1ll * j * dp[i][j][k] % mod) %= mod; (dp[i + 1][j][k] += 1ll * (n - j - k) * dp[i][j][k]) %= mod; } } } cout << dp[m][0][n] << endl; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | Luzhiled |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 553 Byte |
Status | WA |
Exec Time | 244 ms |
Memory | 132864 KB |
Judge Result
Set Name | sample | all | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1000 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt, sample-03.txt |
all | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | AC | 1 ms | 256 KB |
01-03.txt | AC | 26 ms | 129280 KB |
01-04.txt | AC | 2 ms | 640 KB |
01-05.txt | WA | 26 ms | 129408 KB |
01-06.txt | WA | 46 ms | 129792 KB |
01-07.txt | WA | 229 ms | 130688 KB |
01-08.txt | WA | 241 ms | 132864 KB |
01-09.txt | WA | 242 ms | 132864 KB |
01-10.txt | AC | 244 ms | 132864 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | WA | 81 ms | 130048 KB |
sample-03.txt | AC | 123 ms | 67328 KB |