CODE FESTIVAL 2016 Final

Submission #5414365

Source codeソースコード

#include <iostream>

using namespace std;
typedef long long ll;
ll mod = 1000000007,dp[305][305][305] = {};
int main(){
	ll i,j,k,n,m;
	cin >> n >> m;
	dp[0][1][0] = 1;
	for(i=0;i<m;i++){
		for(j=1;j<=n;j++){
			for(k=0;k<=n - j;k++){
				(dp[i + 1][j + k][0] += j*dp[i][j][k]) %= mod;
				(dp[i + 1][j][k] += k*dp[i][j][k]) %= mod;
				(dp[i + 1][j][k + 1] += (n - j - k)*dp[i][j][k]) %= mod;
			}
		}
	}
	cout << dp[m][n][0] << endl;
}

Submission

Task問題 F - Road of the King
User nameユーザ名 Alt3
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 1000
Source lengthソースコード長 456 Byte
File nameファイル名
Exec time実行時間 432 ms
Memory usageメモリ使用量 218624 KB

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt,sample-03.txt
all 1000 / 1000 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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 78 ms 217728 KB
01-07.txt AC 405 ms 218624 KB
01-08.txt AC 427 ms 218624 KB
01-09.txt AC 429 ms 218624 KB
01-10.txt AC 432 ms 218624 KB
sample-01.txt AC 2 ms 2304 KB
sample-02.txt AC 141 ms 217984 KB
sample-03.txt AC 216 ms 110080 KB