結果
問題 | No.949 飲酒プログラミングコンテスト |
ユーザー | face4 |
提出日時 | 2019-12-12 11:12:28 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 1,375 ms |
コンパイル使用メモリ | 10,840 KB |
実行使用メモリ | 14,980 KB |
最終ジャッジ日時 | 2023-09-07 02:29:28 |
合計ジャッジ時間 | 4,899 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
14,980 KB |
testcase_01 | AC | 16 ms
7,872 KB |
testcase_02 | AC | 16 ms
7,852 KB |
testcase_03 | AC | 16 ms
7,820 KB |
testcase_04 | AC | 17 ms
7,980 KB |
testcase_05 | AC | 22 ms
7,860 KB |
testcase_06 | AC | 21 ms
7,956 KB |
testcase_07 | AC | 38 ms
7,776 KB |
testcase_08 | AC | 126 ms
7,940 KB |
testcase_09 | AC | 45 ms
7,952 KB |
testcase_10 | AC | 68 ms
7,812 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 | -- | - |
ソースコード
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) d = list(map(int, input().split())) a.reverse() b.reverse() d.sort() d.append(1<<30) ans = 0 dp = [0]*(n+1) for i in range(n+1): ndp = [0]*(n+1) for j in range(n+1): if i+1 <= n: ndp[j] = max(ndp[j], dp[j]+(1 if a[i+1]+b[j]>=d[dp[j]] else 0)) if j+1 <= n: dp[j+1] = max(dp[j+1], dp[j]+(1 if a[i]+b[j+1]>=d[dp[j]] else 0)) ans = max(ans, max(dp[:n+(1 if i != n else 0)])) dp = ndp print(ans)