Submission #992349
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define pb push_back #define P 1000000007 #define N 310 int n, m; int f[N][N][N]; int main() { cin >> n >> m; f[0][1][0] = 1; for (int i = 0; i < m; i ++) for (int j = 1; j <= n; j ++) for (int k = 0; k <= n-j; k ++) if (f[i][j][k]) { (f[i+1][j+k][0] += (ll)f[i][j][k]*j%P) %= P; (f[i+1][j][k] += (ll)f[i][j][k]*k%P) %= P; (f[i+1][j][k+1] += (ll)f[i][j][k]*(n-j-k)%P) %= P; } cout << f[m][n][0] << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | sevenkplus |
Language | C++14 (GCC 5.4.1) |
Score | 1000 |
Code Size | 597 Byte |
Status | AC |
Exec Time | 183 ms |
Memory | 55808 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 | 6 ms | 1792 KB |
01-04.txt | AC | 3 ms | 256 KB |
01-05.txt | AC | 11 ms | 4608 KB |
01-06.txt | AC | 67 ms | 28672 KB |
01-07.txt | AC | 179 ms | 55296 KB |
01-08.txt | AC | 182 ms | 55808 KB |
01-09.txt | AC | 183 ms | 55808 KB |
01-10.txt | AC | 182 ms | 55808 KB |
sample-01.txt | AC | 3 ms | 256 KB |
sample-02.txt | AC | 109 ms | 41984 KB |
sample-03.txt | AC | 57 ms | 14336 KB |