Submission #5414365
Source Code Expand
#include <iostream> using namespace std; typedef long long ll; ll mod = 1000000007,dp[305][305][305] = {}; int main(){ ll i,j,k,n,m; cin >> n >> m; dp[0][1][0] = 1; for(i=0;i<m;i++){ for(j=1;j<=n;j++){ for(k=0;k<=n - j;k++){ (dp[i + 1][j + k][0] += j*dp[i][j][k]) %= mod; (dp[i + 1][j][k] += k*dp[i][j][k]) %= mod; (dp[i + 1][j][k + 1] += (n - j - k)*dp[i][j][k]) %= mod; } } } cout << dp[m][n][0] << endl; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | Alt3 |
Language | C++14 (GCC 5.4.1) |
Score | 1000 |
Code Size | 456 Byte |
Status | AC |
Exec Time | 432 ms |
Memory | 218624 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, 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 | 43 ms | 217344 KB |
01-04.txt | AC | 3 ms | 1024 KB |
01-05.txt | AC | 44 ms | 217344 KB |
01-06.txt | AC | 78 ms | 217728 KB |
01-07.txt | AC | 405 ms | 218624 KB |
01-08.txt | AC | 427 ms | 218624 KB |
01-09.txt | AC | 429 ms | 218624 KB |
01-10.txt | AC | 432 ms | 218624 KB |
sample-01.txt | AC | 2 ms | 2304 KB |
sample-02.txt | AC | 141 ms | 217984 KB |
sample-03.txt | AC | 216 ms | 110080 KB |