結果
問題 | No.951 【本日限定】1枚頼むともう1枚無料! |
ユーザー | nebukuro09 |
提出日時 | 2019-12-17 03:10:53 |
言語 | D (dmd 2.106.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 949 bytes |
コンパイル時間 | 794 ms |
コンパイル使用メモリ | 111,168 KB |
実行使用メモリ | 741,132 KB |
最終ジャッジ日時 | 2023-09-04 04:07:12 |
合計ジャッジ時間 | 11,658 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
8,752 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,384 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 89 ms
23,524 KB |
testcase_10 | AC | 49 ms
14,568 KB |
testcase_11 | AC | 50 ms
15,484 KB |
testcase_12 | AC | 697 ms
163,980 KB |
testcase_13 | TLE | - |
testcase_14 | AC | 392 ms
95,232 KB |
testcase_15 | AC | 411 ms
103,312 KB |
testcase_16 | AC | 656 ms
156,004 KB |
testcase_17 | AC | 786 ms
185,400 KB |
testcase_18 | AC | 1 ms
4,376 KB |
testcase_19 | AC | 2 ms
4,376 KB |
testcase_20 | AC | 1 ms
4,380 KB |
testcase_21 | AC | 47 ms
14,944 KB |
testcase_22 | AC | 17 ms
7,496 KB |
testcase_23 | AC | 26 ms
10,084 KB |
testcase_24 | MLE | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
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 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; void main() { auto s = readln.split.map!(to!int); auto N = s[0]; auto M = s[1]; auto A = iota(N).map!(_ => readln.split.map!(to!int).array).array; A.sort!"a[0] > b[0]"; auto dp = new int[][][](N+1, M+1, 2); foreach (i; 0..N+1) foreach (j; 0..M+1) dp[i][j][1] = -(1 << 29); foreach (i; 0..N) foreach (j; 0..M+1) { int p = A[i][0]; int d = A[i][1]; dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][0]); dp[i+1][j][1] = max(dp[i+1][j][1], dp[i][j][1]); if (p + j <= M) dp[i+1][j+p][1] = max(dp[i+1][j+p][1], dp[i][j][0] + d); dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][1] + d); } int ans = 0; foreach (j; 0..M+1) foreach (k; 0..2) ans = max(ans, dp[N][j][k]); ans.writeln; }