Submission #1006744
Source Code Expand
#include <iostream> using namespace std; typedef long long ll; ll n, m; ll dp[310][310][310]; const ll MOD = 1e9 + 7; int main(){ cin>>n>>m; dp[0][1][1] = 1LL; for(int i = 0; i < m; i++) { for(int j = 0; j <= n; j++) { for(int k = 0; k <= n; k++) { (dp[i+1][j+1][k] += dp[i][j][k] * (n - j)) %= MOD; (dp[i+1][j][k] += dp[i][j][k] * (j - k)) %= MOD; (dp[i+1][j][j] += dp[i][j][k] * k) %= MOD; } } } cout << dp[m][n][n] << endl; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | T1610 |
Language | C++14 (GCC 5.4.1) |
Score | 1000 |
Code Size | 486 Byte |
Status | AC |
Exec Time | 554 ms |
Memory | 220800 KB |
Judge Result
Set Name | sample | all | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1000 / 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 3 ms | 256 KB |
01-02.txt | AC | 3 ms | 256 KB |
01-03.txt | AC | 10 ms | 3584 KB |
01-04.txt | AC | 5 ms | 1024 KB |
01-05.txt | AC | 21 ms | 9472 KB |
01-06.txt | AC | 136 ms | 67072 KB |
01-07.txt | AC | 528 ms | 212864 KB |
01-08.txt | AC | 549 ms | 219392 KB |
01-09.txt | AC | 547 ms | 220160 KB |
01-10.txt | AC | 554 ms | 220800 KB |
sample-01.txt | AC | 3 ms | 256 KB |
sample-02.txt | AC | 242 ms | 111488 KB |
sample-03.txt | AC | 280 ms | 110592 KB |