CODE FESTIVAL 2016 Final

Submission #5512037

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(610,vector<ll>(610)),dp2(610,vector<ll>(610));
    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>>(610,vector<ll>(610));
        //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状態 AC
Score得点 1000
Source lengthソースコード長 1890 Byte
File nameファイル名
Exec time実行時間 1122 ms
Memory usageメモリ使用量 9100 KB

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 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 6 ms 9088 KB
01-02.txt AC 7 ms 9088 KB
01-03.txt AC 243 ms 9096 KB
01-04.txt AC 10 ms 9088 KB
01-05.txt AC 243 ms 9096 KB
01-06.txt AC 321 ms 9100 KB
01-07.txt AC 1051 ms 9100 KB
01-08.txt AC 1102 ms 9100 KB
01-09.txt AC 1104 ms 9100 KB
01-10.txt AC 1122 ms 9096 KB
sample-01.txt AC 9 ms 9100 KB
sample-02.txt AC 462 ms 9096 KB
sample-03.txt AC 566 ms 9096 KB