def func(n, v, a):     L, R = 0, 0     res = 0     s = 0     while R < n:         if s | a[R] <= v:             s |= a[R]             res = max(res, R - L + 1)         else:             s = 0             newL = R+1             for i in range(R, L, -1):                 if s | a[i] > v:                     break                 else:                     s |= a[i]                     newL = i             L = newL         R += 1         # print(L,R)     return str(res) 第三题
点赞 1

相关推荐

牛客网
牛客企业服务