結果

問題 No.1111 コード進行
ユーザー NewGardenNewGarden
提出日時 2020-07-10 21:54:06
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,970 bytes
コンパイル時間 1,258 ms
コンパイル使用メモリ 128,100 KB
実行使用メモリ 240,768 KB
最終ジャッジ日時 2024-04-19 16:54:23
合計ジャッジ時間 14,431 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 185 ms
240,512 KB
testcase_01 AC 184 ms
240,640 KB
testcase_02 AC 182 ms
240,512 KB
testcase_03 WA -
testcase_04 AC 181 ms
240,512 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 188 ms
240,512 KB
testcase_08 AC 187 ms
240,512 KB
testcase_09 WA -
testcase_10 AC 186 ms
240,512 KB
testcase_11 AC 182 ms
240,512 KB
testcase_12 RE -
testcase_13 AC 191 ms
240,512 KB
testcase_14 WA -
testcase_15 AC 186 ms
240,512 KB
testcase_16 RE -
testcase_17 AC 191 ms
240,640 KB
testcase_18 AC 189 ms
240,512 KB
testcase_19 AC 188 ms
240,512 KB
testcase_20 AC 187 ms
240,640 KB
testcase_21 AC 189 ms
240,512 KB
testcase_22 AC 191 ms
240,512 KB
testcase_23 AC 192 ms
240,512 KB
testcase_24 AC 192 ms
240,640 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 186 ms
240,512 KB
testcase_28 AC 203 ms
240,640 KB
testcase_29 AC 193 ms
240,640 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 200 ms
240,640 KB
testcase_35 AC 203 ms
240,512 KB
testcase_36 AC 220 ms
240,512 KB
testcase_37 AC 202 ms
240,512 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 211 ms
240,512 KB
testcase_42 AC 215 ms
240,640 KB
testcase_43 WA -
testcase_44 AC 199 ms
240,640 KB
testcase_45 AC 210 ms
240,512 KB
testcase_46 WA -
testcase_47 AC 277 ms
240,640 KB
testcase_48 AC 192 ms
240,640 KB
testcase_49 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
    mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { mint res(*this); return res+=a; }
    mint operator-(const mint a) const { mint res(*this); return res-=a; }
    mint operator*(const mint a) const { mint res(*this); return res*=a; }
    mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const { mint res(*this); return res/=a; }
};

int main(){
  int n,m,l;
  cin >> n >> m >> l;
  vector<P> v[310];
  rep(i,m){
    int x,y,c; cin >> x >> y >> c; x--; y--;
    v[x].emplace_back(y,c);
  }

  vector<vector<vector<mint>>> dp(310, vector<vector<mint>>(310, vector<mint>(310,0)));
  rep(i,300){
    dp[0][i][0] = 1;
  }
  rep(i,n)rep(j,300)rep(k,l+1){
    for(auto it:v[j]){
      dp[i+1][it.S][k+it.S] += dp[i][j][k];
    }
  }
  mint ans = 0;
  rep(i,300){
    ans += dp[n][i][l];
  }
  cout << ans.x << ln;
  return 0;
}
0