Tap here to switch tabs
Problem
Submissions

Problem: Maximum Sized Array

Maximum Sized Array uses a non-negative budget s to find the largest cube dimension whose total sum stays within it, with each entry multiplying its first index by the bitwise OR of two indices.

Statement

You are given a non-negative integer s.

Consider a three-dimensional array A of dimensions n×n×nn \times n \times n, indexed from 00 to n−1n - 1, where each element at index (i,j,k)(i, j, k) is defined as:

A[i][j][k] =i×(j OR k)= i \times (j \text{ OR } k)

where OR represents the bitwise OR operator.

Return the maximum integer n such that the total sum of all elements in the array A does not exceed s.

Constraints:

  • 0≤0 \leq s ≤1015\leq 10^{15}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Sized Array

Maximum Sized Array uses a non-negative budget s to find the largest cube dimension whose total sum stays within it, with each entry multiplying its first index by the bitwise OR of two indices.

Statement

You are given a non-negative integer s.

Consider a three-dimensional array A of dimensions n×n×nn \times n \times n, indexed from 00 to n−1n - 1, where each element at index (i,j,k)(i, j, k) is defined as:

A[i][j][k] =i×(j OR k)= i \times (j \text{ OR } k)

where OR represents the bitwise OR operator.

Return the maximum integer n such that the total sum of all elements in the array A does not exceed s.

Constraints:

  • 0≤0 \leq s ≤1015\leq 10^{15}