Submission #2370000
Source Code Expand
#include <bits/stdc++.h> using namespace std; constexpr int mod = 1e9 + 7; int64_t 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] += k * dp[i][j][k] % mod) %= mod; (dp[i + 1][j - 1][k] += j * dp[i][j][k] % mod) %= mod; (dp[i + 1][j][k] += (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 | 539 Byte |
Status | MLE |
Exec Time | 273 ms |
Memory | 263424 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 | MLE | 63 ms | 260352 KB |
01-04.txt | AC | 2 ms | 1024 KB |
01-05.txt | MLE | 52 ms | 260352 KB |
01-06.txt | MLE | 72 ms | 260864 KB |
01-07.txt | MLE | 257 ms | 261376 KB |
01-08.txt | MLE | 270 ms | 263424 KB |
01-09.txt | MLE | 271 ms | 263424 KB |
01-10.txt | MLE | 273 ms | 263424 KB |
sample-01.txt | AC | 2 ms | 2304 KB |
sample-02.txt | MLE | 108 ms | 260992 KB |
sample-03.txt | AC | 137 ms | 132352 KB |