結果
問題 | No.949 飲酒プログラミングコンテスト |
ユーザー | pekempey |
提出日時 | 2019-12-12 00:19:04 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 683 bytes |
コンパイル時間 | 1,017 ms |
コンパイル使用メモリ | 87,028 KB |
実行使用メモリ | 391,280 KB |
最終ジャッジ日時 | 2023-09-06 13:36:07 |
合計ジャッジ時間 | 18,130 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
71,408 KB |
testcase_01 | AC | 72 ms
71,212 KB |
testcase_02 | AC | 71 ms
71,416 KB |
testcase_03 | AC | 70 ms
71,260 KB |
testcase_04 | AC | 78 ms
75,820 KB |
testcase_05 | AC | 95 ms
76,764 KB |
testcase_06 | AC | 88 ms
76,268 KB |
testcase_07 | AC | 105 ms
77,796 KB |
testcase_08 | AC | 136 ms
78,596 KB |
testcase_09 | AC | 120 ms
77,428 KB |
testcase_10 | AC | 123 ms
77,732 KB |
testcase_11 | AC | 2,149 ms
366,924 KB |
testcase_12 | TLE | - |
testcase_13 | AC | 2,022 ms
312,568 KB |
testcase_14 | AC | 340 ms
112,176 KB |
testcase_15 | AC | 1,522 ms
317,400 KB |
testcase_16 | TLE | - |
testcase_17 | AC | 357 ms
108,768 KB |
testcase_18 | TLE | - |
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 | -- | - |
ソースコード
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) D = list(map(int, input().split())) D.sort(reverse=True) l = -1 r = N while r - l > 1: m = (l + r) // 2 dp = [[False for j in range(N+1-m)] for i in range(N+1-m)] dp[0][0] = True for i in range(N-m): for j in range(N-m): if i + j + m >= N: continue if not dp[i][j]: continue if A[i+1] + B[j] >= D[i+j+m]: dp[i+1][j] = True if A[i] + B[j+1] >= D[i+j+m]: dp[i][j+1] = True ans = 0 for i in range(N+1-m): for j in range(N+1-m): if dp[i][j]: ans = max(ans, i+j) if ans == N - m: r = m else: l = m print(N - r)