思路:阅读理解,模拟。由于两者做题顺序一致,都是从左到右,因此我们就可以从左到右遍历每一题,然后判断两者会不会做这题即可。对于clccle来说,难度<他的预期并且花费时间足够才会做题;对于rqy来说,难度>=他的预期并且花费时间的2倍足够才会做题;难度<他的预期并且花费时间足够才会做题。最终遍历,模拟一遍,输出结果即可

代码:

import sys
input = lambda: sys.stdin.readline().strip()

import math
inf = 10 ** 18

def I():
    return input()

def II():
    return int(input())

def MII():
    return map(int, input().split())

def GMI():
    return map(lambda x: int(x) - 1, input().split())

def LI():
    return input().split()

def LII():
    return list(map(int, input().split()))

def LFI():
    return list(map(float, input().split()))

fmax = lambda x, y: x if x > y else y
fmin = lambda x, y: x if x < y else y
isqrt = lambda x: int(math.sqrt(x))

'''

'''

def solve():
    n, t = MII()
    a, b = MII()
    time = LII()
    diff = LII()

    ta = tb = t
    cnta = cntb = 0
    for i in range(n):
        tm, df = time[i], diff[i]
        if df < a and ta >= tm:
            cnta += 1
            ta -= tm
        if df >= b and tb >= 2 * tm:
            cntb += 1
            tb -= 2 * tm
        elif df < b and tb >= tm:
            cntb += 1
            tb -= tm

    print(cnta, cntb)

tt = 1
# t = II()
for _ in range(tt):
    solve()