CODE FESTIVAL 2016 Final

Submission #5511109

Source codeソースコード

#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

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

Compiler messageコンパイルメッセージ

./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;}
^

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt,sample-03.txt
all 0 / 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 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
01-08.txt RE
01-09.txt RE
01-10.txt RE
sample-01.txt AC 3 ms 2564 KB
sample-02.txt AC 281 ms 2632 KB
sample-03.txt AC 2 ms 1792 KB