Submission #1461569
Source Code Expand
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef vector<VL> VVL; typedef pair<int,int> P; typedef pair<ll,ll> PL; const ll mod = 1e9 + 7; ll dp[301][301][301]; int main(void){ int n, m; cin >> n >> m; dp[0][1][0] = 1; REP(i,m) REP(j,n+1) REP(k,n+1){ dp[i+1][j][k] = (dp[i+1][j][k] + k * dp[i][j][k]) % mod; dp[i+1][j+k][0] = (dp[i+1][j+k][0] + j * dp[i][j][k]) % mod; dp[i+1][j][k+1] = (dp[i+1][j][k+1] + (n - k - j) * dp[i][j][k]) % mod; } // FOR(i,1,m){ // cout << i << endl; // REP(j,n+1){ // REP(k,n+1) cout << dp[i][j][k] << " "; // cout << endl; // } // cout << endl; // } cout << dp[m][n][0] << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Road of the King |
User | TangentDay |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1247 Byte |
Status | RE |
Exec Time | 303 ms |
Memory | 212608 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 | AC | 34 ms | 167040 KB |
01-04.txt | AC | 3 ms | 3584 KB |
01-05.txt | AC | 42 ms | 180864 KB |
01-06.txt | AC | 61 ms | 211968 KB |
01-07.txt | AC | 197 ms | 212480 KB |
01-08.txt | RE | 303 ms | 212608 KB |
01-09.txt | RE | 303 ms | 212608 KB |
01-10.txt | RE | 303 ms | 212608 KB |
sample-01.txt | AC | 2 ms | 2304 KB |
sample-02.txt | AC | 83 ms | 212608 KB |
sample-03.txt | AC | 105 ms | 108032 KB |