Submission #5511109


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<ll>> dp(310,vector<ll>(310)),dp2(310,vector<ll>(310));
    dp[1][0]=1ll;
    if(n>m){cout<<0;return 0;}
    rep(i,m){
        rep(j,n+1){
            rep(k,n+1){
                ll s=dp[j][k];
                dp2[j+k][0]=(dp2[j+k][0]+s*j)%MOD;
                dp2[j][k]=(dp2[j][k]+s*k)%MOD;
                dp2[j][k+1]=(dp2[j][k+1]+s*(n-j-k))%MOD;
            }
        }
        //cout<<"passed";
        dp=dp2;
        dp2=vector<vector<ll>>(310,vector<ll>(310));
        //cout<<"passed";
    }
    cout<<dp[n][0]<<endl;
}

Submission Info

Submission Time
Task F - Road of the King
User noimi
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1888 Byte
Status RE
Exec Time 281 ms
Memory 2632 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
AC × 3
AC × 12
RE × 4
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 2 ms 1792 KB
01-02.txt AC 3 ms 2560 KB
01-03.txt AC 63 ms 2588 KB
01-04.txt AC 2 ms 1792 KB
01-05.txt AC 64 ms 2588 KB
01-06.txt AC 140 ms 2588 KB
01-07.txt RE 144 ms 1792 KB
01-08.txt RE 104 ms 1792 KB
01-09.txt RE 100 ms 1792 KB
01-10.txt RE 104 ms 1792 KB
sample-01.txt AC 3 ms 2564 KB
sample-02.txt AC 281 ms 2632 KB
sample-03.txt AC 2 ms 1792 KB