Submission #2663698
Source Code Expand
#include <bits/stdc++.h> #define int long long #define r(i,n) for(int i=0;i<n;i++) using namespace std; int dp[333][333][333],ans,n,m; int mod=1000000007; signed main(){ cin>>n>>m; dp[0][1][1]=1; 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); dp[i+1][j][j]+=dp[i][j][k]*k; dp[i+1][j][k]+=dp[i][j][k]*(j-k); dp[i+1][j+1][k]%=mod; dp[i+1][j][j]%=mod; dp[i+1][j][k]%=mod; } } } cout<<dp[m][n][n]<<endl; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | c7c7 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 564 Byte |
Status | MLE |
Exec Time | 844 ms |
Memory | 261504 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 | 51 ms | 258304 KB |
01-04.txt | AC | 4 ms | 1024 KB |
01-05.txt | MLE | 52 ms | 258304 KB |
01-06.txt | MLE | 123 ms | 260864 KB |
01-07.txt | MLE | 789 ms | 259328 KB |
01-08.txt | MLE | 839 ms | 261376 KB |
01-09.txt | MLE | 838 ms | 261504 KB |
01-10.txt | MLE | 844 ms | 261504 KB |
sample-01.txt | AC | 2 ms | 2304 KB |
sample-02.txt | MLE | 252 ms | 260992 KB |
sample-03.txt | AC | 422 ms | 130432 KB |