How to declare an array of 10^18 elements?
The program you are trying to aim has already complexity of minimum O(10^18) which will take forever to run.
For max allocation of memory, it depends on architecture and data type size.
For 64-bit architecture containers like vector:
- vector max_size() will return: 4611686018427387903
- vector max_size() will return: 9223372036854775776
max array size will be :-
for local declaration :- 10^6 to 10^7
for global declaration :-10^7 to 10^8
I am facing the same problem can anyone help?