結果
問題 | No.949 飲酒プログラミングコンテスト |
ユーザー | tamato |
提出日時 | 2019-12-12 15:39:53 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,199 bytes |
コンパイル時間 | 1,323 ms |
コンパイル使用メモリ | 86,700 KB |
実行使用メモリ | 184,368 KB |
最終ジャッジ日時 | 2023-09-07 07:49:58 |
合計ジャッジ時間 | 8,321 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 91 ms
75,792 KB |
testcase_01 | AC | 90 ms
71,920 KB |
testcase_02 | AC | 92 ms
71,440 KB |
testcase_03 | AC | 92 ms
71,496 KB |
testcase_04 | AC | 94 ms
71,480 KB |
testcase_05 | AC | 96 ms
72,236 KB |
testcase_06 | AC | 95 ms
71,040 KB |
testcase_07 | AC | 94 ms
72,248 KB |
testcase_08 | AC | 111 ms
77,156 KB |
testcase_09 | AC | 105 ms
77,028 KB |
testcase_10 | AC | 110 ms
77,164 KB |
testcase_11 | AC | 627 ms
184,368 KB |
testcase_12 | AC | 130 ms
78,700 KB |
testcase_13 | AC | 409 ms
145,716 KB |
testcase_14 | AC | 119 ms
77,244 KB |
testcase_15 | TLE | - |
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 | -- | - |
ソースコード
from collections import defaultdict def main(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) D = list(map(int, input().split())) D.sort() ok = 0 ng = N+1 mid = (ok + ng) // 2 while ng - ok > 1: seen = defaultdict(int) st = [(0, 0)] seen[(0, 0)] = 1 flg = 0 while st: i, j = st.pop() if i+1 <= N: if seen[(i+1, j)] == 0: seen[(i+1, j)] = 1 if A[i+1] + B[j] >= D[mid-(i+j+1)]: if i+j+1 == mid: flg = 1 break st.append((i+1, j)) if j+1 <= N: if seen[(i, j+1)] == 0: seen[(i, j+1)] = 1 if A[i] + B[j+1] >= D[mid-(i+j+1)]: if i+j+1 == mid: flg = 1 break st.append((i, j+1)) if flg: ok = mid else: ng = mid mid = (ok+ng)//2 print(ok) if __name__ == '__main__': main()