Submission #3677579
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int mo=1e9+7; #define ll long long ll dp[305][305][305],n,m; int main() { cin>>n>>m; dp[0][1][1]=1; for(int i=1;i<=m;i++) for(int j=1;j<=n;j++) for(int k=1;k<=n;k++){ (dp[i][j][k]+=dp[i-1][j-1][k]*(n-j+1)%mo)%=mo; (dp[i][j][k]+=dp[i-1][j][k]*(j-k)%mo)%=mo; (dp[i][j][j]+=dp[i-1][j][k]*k%mo)%=mo; } cout<<dp[m][n][n]%mo<<endl; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | victorique |
Language | C++14 (GCC 5.4.1) |
Score | 1000 |
Code Size | 420 Byte |
Status | AC |
Exec Time | 313 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 | 68 ms | 217728 KB |
01-07.txt | AC | 294 ms | 218624 KB |
01-08.txt | AC | 309 ms | 218624 KB |
01-09.txt | AC | 311 ms | 218624 KB |
01-10.txt | AC | 313 ms | 218624 KB |
sample-01.txt | AC | 2 ms | 2304 KB |
sample-02.txt | AC | 111 ms | 218112 KB |
sample-03.txt | AC | 158 ms | 110080 KB |