Tap here to switch tabs
Problem
Submissions

Problem: Maximum Sized Array

Try to solve the Maximum Sized Array problem.

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

Try to solve the Maximum Sized Array problem.

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}