結果
問題 | No.1111 コード進行 |
ユーザー | shojin_pro |
提出日時 | 2020-07-10 22:49:05 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,091 bytes |
コンパイル時間 | 4,271 ms |
コンパイル使用メモリ | 80,852 KB |
実行使用メモリ | 265,244 KB |
最終ジャッジ日時 | 2024-10-11 10:08:29 |
合計ジャッジ時間 | 11,439 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 58 ms
49,812 KB |
testcase_01 | AC | 57 ms
50,048 KB |
testcase_02 | AC | 56 ms
50,408 KB |
testcase_03 | AC | 57 ms
50,020 KB |
testcase_04 | AC | 57 ms
50,356 KB |
testcase_05 | AC | 59 ms
52,596 KB |
testcase_06 | AC | 69 ms
55,120 KB |
testcase_07 | AC | 70 ms
55,408 KB |
testcase_08 | AC | 79 ms
50,740 KB |
testcase_09 | AC | 68 ms
54,512 KB |
testcase_10 | AC | 64 ms
55,120 KB |
testcase_11 | AC | 61 ms
50,056 KB |
testcase_12 | AC | 79 ms
55,924 KB |
testcase_13 | AC | 60 ms
52,248 KB |
testcase_14 | AC | 81 ms
56,248 KB |
testcase_15 | AC | 60 ms
50,228 KB |
testcase_16 | AC | 80 ms
55,548 KB |
testcase_17 | AC | 62 ms
55,272 KB |
testcase_18 | AC | 59 ms
49,932 KB |
testcase_19 | AC | 56 ms
50,148 KB |
testcase_20 | AC | 58 ms
52,352 KB |
testcase_21 | AC | 58 ms
50,264 KB |
testcase_22 | AC | 65 ms
59,480 KB |
testcase_23 | AC | 62 ms
52,412 KB |
testcase_24 | AC | 61 ms
55,120 KB |
testcase_25 | AC | 106 ms
61,016 KB |
testcase_26 | AC | 77 ms
56,252 KB |
testcase_27 | AC | 61 ms
50,424 KB |
testcase_28 | AC | 201 ms
189,964 KB |
testcase_29 | AC | 135 ms
113,752 KB |
testcase_30 | WA | - |
testcase_31 | AC | 72 ms
62,600 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 159 ms
130,792 KB |
testcase_35 | AC | 177 ms
149,840 KB |
testcase_36 | AC | 268 ms
190,168 KB |
testcase_37 | AC | 140 ms
76,468 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | AC | 205 ms
191,632 KB |
testcase_42 | AC | 182 ms
114,496 KB |
testcase_43 | WA | - |
testcase_44 | AC | 119 ms
76,044 KB |
testcase_45 | AC | 186 ms
131,300 KB |
testcase_46 | WA | - |
testcase_47 | AC | 442 ms
265,244 KB |
testcase_48 | AC | 109 ms
54,056 KB |
testcase_49 | AC | 108 ms
54,048 KB |
ソースコード
import java.util.*; import java.io.*; public class Main { static int n,m,k; static ArrayList<Music> li; public static void main(String[] args) throws Exception { FastScanner sc = new FastScanner(System.in); long mod = (long)Math.pow(10,9)+7; n = sc.nextInt(); m = sc.nextInt(); k = sc.nextInt(); li = new ArrayList<>(); for(int i = 0; i < m; i++){ int p = sc.nextInt()-1; int q = sc.nextInt()-1; int c = sc.nextInt(); li.add(new Music(p,q,c)); } Collections.sort(li); long[][][] dp = new long[300][n+1][k+2]; for(int i = 0; i < 300; i++){ dp[i][1][0] = 1; } for(int i = 2; i <= n; i++){ for(Music m : li){ for(int j = k-m.c; j >= 0; j--){ dp[m.q][i][j+m.c] += dp[m.p][i-1][j]; } } } long ans = 0; for(int i = 0; i < 300; i++){ ans += dp[i][n][k]; ans %= mod; } System.out.println(ans); } } class Music implements Comparable<Music>{ int p,q,c; public Music(int p, int q, int c){ this.p = p; this.q = q; this.c = c; } public int compareTo(Music m){ if(this.c > m.c){ return -1; }else if(this.c < m.c){ return 1; }else{ return 0; } } } class FastScanner { private BufferedReader reader = null; private StringTokenizer tokenizer = null; public FastScanner(InputStream in) { reader = new BufferedReader(new InputStreamReader(in)); tokenizer = null; } public String next() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public String nextLine() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken("\n"); } public long nextLong() { return Long.parseLong(next()); } public int nextInt() { return Integer.parseInt(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String[] nextArray(int n) { String[] a = new String[n]; for (int i = 0; i < n; i++) a[i] = next(); return a; } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public long[] nextLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } }