結果
問題 | No.1715 Dinner 2 |
ユーザー | irumo8202 |
提出日時 | 2022-01-22 10:25:00 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
TLE
|
実行時間 | - |
コード長 | 941 bytes |
コンパイル時間 | 273 ms |
コンパイル使用メモリ | 11,088 KB |
実行使用メモリ | 43,436 KB |
最終ジャッジ日時 | 2023-08-18 02:24:21 |
合計ジャッジ時間 | 5,619 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
12,704 KB |
testcase_01 | AC | 17 ms
8,240 KB |
testcase_02 | AC | 18 ms
8,392 KB |
testcase_03 | AC | 16 ms
8,240 KB |
testcase_04 | AC | 18 ms
7,848 KB |
testcase_05 | AC | 17 ms
7,864 KB |
testcase_06 | AC | 16 ms
7,992 KB |
testcase_07 | AC | 17 ms
7,864 KB |
testcase_08 | AC | 17 ms
7,952 KB |
testcase_09 | AC | 16 ms
8,256 KB |
testcase_10 | AC | 17 ms
8,168 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
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 | -- | - |
ソースコード
N, D = map(int, input().split()) INF = 1 << 60 p = [] q = [] for _ in range(N): s, t = map(int, input().split()) p.append(s) q.append(t) def solve(x): dp = [[-INF] * N for _ in range(D)] for i in range(N): if -p[i] >= x: dp[0][i] = q[i] - p[i] for i in range(1, D): la = [-INF for _ in range(N + 1)] ra = [-INF for _ in range(N + 1)] for j in range(N): la[j + 1] = max(la[j], dp[i - 1][j]) ra[j + 1] = max(ra[j], dp[i - 1][N - j - 1]) for j in range(N): tmp = max(la[j], ra[N - j - 1]) if tmp - p[j] >= x: dp[i][j] = tmp - p[j] + q[j] for i in range(N): if dp[D - 1][i] != -INF: return True return False left = -(10 ** 8) right = 0 while right - left > 1: mid = (right + left) // 2 if solve(mid): left = mid else: right = mid print(left)