Submission #5506762
Source Code Expand
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
main(){
int n=in();
int m=in();
vector<vector<vector<ll>>> dp(350,vector<vector<ll>>(350,vector<ll>(350)));
dp[0][1][0]=1;
rep(i,m){
rep(j,n+1){
rep(k,n+1){
ll s=dp[i][j][k];
dp[i+1][j+k][0]=(dp[i+1][j+k][0]+s*j)%MOD;
dp[i+1][j][k]=(dp[i+1][j][k]+s*k)%MOD;
dp[i+1][j][k+1]=(dp[i+1][j][k+1]+s*(n-j-k))%MOD;
}
}
}
cout<<dp[m][n][0]<<endl;
}
Submission Info
Submission Time
2019-05-21 19:51:38+0900
Task
F - Road of the King
User
noimi
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
1769 Byte
Status
RE
Exec Time
486 ms
Memory
340992 KB
Compile Error
./Main.cpp: In function ‘int in()’:
./Main.cpp:44:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int in() {int x;scanf("%d",&x);return x;}
^
./Main.cpp: In function ‘long long int lin()’:
./Main.cpp:45:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
ll lin() {ll x;scanf("%lld",&x);return x;}
^
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
MLE
198 ms
340992 KB
01-02.txt
MLE
202 ms
340992 KB
01-03.txt
MLE
203 ms
340992 KB
01-04.txt
RE
486 ms
340992 KB
01-05.txt
MLE
205 ms
340992 KB
01-06.txt
MLE
284 ms
340992 KB
01-07.txt
RE
287 ms
340992 KB
01-08.txt
RE
286 ms
340992 KB
01-09.txt
RE
285 ms
340992 KB
01-10.txt
RE
282 ms
340992 KB
sample-01.txt
MLE
204 ms
340992 KB
sample-02.txt
MLE
430 ms
340992 KB
sample-03.txt
RE
286 ms
340992 KB