結果
問題 | No.1111 コード進行 |
ユーザー | sca1l |
提出日時 | 2020-07-20 21:42:04 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,701 bytes |
コンパイル時間 | 3,149 ms |
コンパイル使用メモリ | 75,940 KB |
実行使用メモリ | 58,216 KB |
最終ジャッジ日時 | 2023-08-26 01:39:28 |
合計ジャッジ時間 | 12,499 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
56,112 KB |
testcase_01 | AC | 99 ms
55,504 KB |
testcase_02 | AC | 100 ms
56,196 KB |
testcase_03 | AC | 108 ms
56,052 KB |
testcase_04 | AC | 108 ms
55,724 KB |
testcase_05 | AC | 107 ms
55,956 KB |
testcase_06 | AC | 137 ms
55,880 KB |
testcase_07 | AC | 156 ms
56,232 KB |
testcase_08 | AC | 151 ms
56,228 KB |
testcase_09 | AC | 150 ms
55,988 KB |
testcase_10 | AC | 112 ms
55,760 KB |
testcase_11 | AC | 139 ms
56,628 KB |
testcase_12 | AC | 152 ms
58,216 KB |
testcase_13 | AC | 110 ms
55,504 KB |
testcase_14 | AC | 256 ms
56,692 KB |
testcase_15 | AC | 113 ms
55,668 KB |
testcase_16 | AC | 139 ms
55,644 KB |
testcase_17 | AC | 105 ms
55,948 KB |
testcase_18 | AC | 102 ms
56,020 KB |
testcase_19 | AC | 106 ms
55,692 KB |
testcase_20 | AC | 109 ms
55,848 KB |
testcase_21 | AC | 109 ms
55,704 KB |
testcase_22 | AC | 107 ms
55,872 KB |
testcase_23 | AC | 114 ms
55,960 KB |
testcase_24 | AC | 106 ms
55,924 KB |
testcase_25 | AC | 180 ms
56,372 KB |
testcase_26 | TLE | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
ソースコード
import java.util.*; public class Main{ static final int MOD = (int)1e9+7; static final int MAX = 301; static int n; static int m; static int k; static ArrayList<Integer>[] graph; static ArrayList<Integer>[] complexity; public static int dfs(int now, int cmp, int cnt){ if(cnt == n || cmp > k){ //System.out.println(cnt + " : " + cmp); if(cnt == n && cmp == k){ return 1; }else{ return 0; } } int ret = 0; for(int i=0; i<graph[now].size(); i++){ int next = graph[now].get(i); int cmpsum = complexity[now].get(i) + cmp; ret += dfs(next, cmpsum, cnt+1); ret %= MOD; } return ret%MOD; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); n = Integer.parseInt(sc.next()); m = Integer.parseInt(sc.next()); k = Integer.parseInt(sc.next()); graph = new ArrayList[MAX]; complexity = new ArrayList[MAX]; for(int i=0; i<MAX; i++){ graph[i] = new ArrayList<>(); complexity[i] = new ArrayList<>(); } for(int i=0; i<m; i++){ int p = Integer.parseInt(sc.next())-1; int q = Integer.parseInt(sc.next())-1; int c = Integer.parseInt(sc.next()); graph[p].add(q); complexity[p].add(c); } int ans = 0; for(int i=0; i<MAX; i++){ ans += dfs(i, 0, 1); ans %= MOD; } System.out.println(ans); } }