The ranklist is out and they haven't deleted this problem. Can anyone post the correct solution to this problem?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
The ranklist is out and they haven't deleted this problem. Can anyone post the correct solution to this problem?
Question:
Given an array of N positive integers. The beautifulness of the array is defined as the bitwise OR of all elements of the array.
Now you have to remove the elements of the given array one by one and calculate the beautifulness of the remaining array and add this value to the answer after each step.
You have to maximize the final answer. Also print an order of the indexes in which you will remove the elements.
Constraints: 1 <= N <= 100,000 1 <= a[i] <= 1000,000,000
Example Case :
Input: N = 5
Array = {1,2,3,4,5}
Output : 33
1 2 4 3 5
Explanation:
Step 0: Array {1,2,3,4,5} OR = 7, SUM = 7
Step 1 : {2,3,4,5} OR = 7, SUM = 14
Step 2 : {3,4,5} OR = 7, SUM = 21
Step 3 : {3,5} OR = 7, SUM = 28
Step 4: {5} OR = 5, SUM = 33
Step 5: {}, SUM = 33
Ans = 33
Is this question even solvable in polynomial time?
Can some one who solved also tell their approach?
Given N points in 2-D plane and Q queries. In each query you are given a rectangle (aligned with x,y axes) defined by the points x1, y1, x2, y2 where (x1, y1) is the lower left corner and (x2, y2) is the upper right corner, find the number of points inside the rectangle. Points on rectangle are considered inside.
Constraints : 1 ≤ N ≤ 100 000 1 ≤ Q ≤ 100 000 0 ≤ xi, yi ≤ 100 000 0 ≤ x1 < x2 ≤ 100 000 0 ≤ y1 < y2 ≤ 100 000
Does anyone have a link to this question or any implementation.
Thanks. DanceTheTragonDrainer.
Название |
---|