結果

問題 No.1111 コード進行
ユーザー mfbgjsczmfbgjscz
提出日時 2020-07-10 22:16:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,848 bytes
コンパイル時間 2,605 ms
コンパイル使用メモリ 212,584 KB
実行使用メモリ 510,860 KB
最終ジャッジ日時 2023-08-01 18:18:08
合計ジャッジ時間 15,888 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 394 ms
510,760 KB
testcase_01 AC 373 ms
510,436 KB
testcase_02 AC 372 ms
510,736 KB
testcase_03 WA -
testcase_04 AC 367 ms
510,396 KB
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 371 ms
510,692 KB
testcase_18 RE -
testcase_19 AC 375 ms
510,644 KB
testcase_20 AC 376 ms
510,756 KB
testcase_21 RE -
testcase_22 AC 376 ms
510,756 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 381 ms
510,696 KB
testcase_29 AC 370 ms
510,764 KB
testcase_30 RE -
testcase_31 WA -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 377 ms
510,688 KB
testcase_35 AC 368 ms
510,816 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 382 ms
510,740 KB
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 384 ms
510,756 KB
testcase_47 AC 468 ms
510,768 KB
testcase_48 AC 385 ms
510,768 KB
testcase_49 AC 380 ms
510,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
*/#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
/*namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;
*/#define lli long long int
#define uli unsigned long long int
#define INF 999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
struct edge{
  int first;
  int second;
};
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> N >> M >> K;
  vector<vector<edge>> P(N);
  rep(i,0,M){
    cin >> A >> B >> C;
    edge e;
    e.first=B-1;
    e.second=C;
    P[A-1].pb(e);
  }
  TV(dp,lli,400,400,400,0);
  rep(i,0,400)dp[0][i][0]=1;
  rep(i,1,N+1){
    rep(j,0,N)for(auto v:P[j]){
      rep(k,0,K+10){
        if(k+v.second<350)dp[i][v.first][k+v.second]=(dp[i-1][j][k]+dp[i][v.first][k+v.second])%mod;
      }
    }
  }
  rep(i,0,N)sum+=dp[N-1][i][K]%mod;
  Out(sum%mod);
}
  
0