Submission #3932369
Source Code Expand
#include <cstdio> const int mod = 1e9+7; int n, m; long long dp[303][303][303]; int main() { scanf("%d %d", &n, &m); dp[0][1][1] = 1; for (int i = 0; i <= m; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= j; k++) { long long now = dp[i][j][k]; dp[i+1][j+1][k] += now*(n-j)%mod; dp[i+1][j][k] += now*(j-k)%mod; dp[i+1][j][j] += now*k%mod; } } } printf("%lld\n", dp[m][n][n] % mod); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | wookje |
Language | C++14 (GCC 5.4.1) |
Score | 1000 |
Code Size | 561 Byte |
Status | AC |
Exec Time | 117 ms |
Memory | 216576 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:8:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d", &n, &m); ^
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 | 128 KB |
01-02.txt | AC | 1 ms | 2176 KB |
01-03.txt | AC | 52 ms | 215168 KB |
01-04.txt | AC | 2 ms | 3584 KB |
01-05.txt | AC | 51 ms | 215296 KB |
01-06.txt | AC | 58 ms | 215680 KB |
01-07.txt | AC | 112 ms | 216448 KB |
01-08.txt | AC | 116 ms | 216576 KB |
01-09.txt | AC | 116 ms | 216576 KB |
01-10.txt | AC | 117 ms | 216576 KB |
sample-01.txt | AC | 1 ms | 2176 KB |
sample-02.txt | AC | 68 ms | 215936 KB |
sample-03.txt | AC | 58 ms | 110080 KB |