Submission
# | When | Author | Problem | Language | CPU | Memory | |
---|---|---|---|---|---|---|---|
20815 | 2024-06-08 22:51:20 | AHAMMED_99 | Find MinMaxXoR Number | C | 0 ms | 1552 kb | Wrong Answer - 3 |
Test Cases
# | CPU | Memory | Points | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 ms | 1552 kb | 1 | Accepted | |||||||
2 | 0 ms | 1552 kb | 1 | Accepted | |||||||
3 | 0 ms | 1536 kb | 0 | Wrong Answer | |||||||
4 | 0 ms | 0 kb | 0 | Skipped | |||||||
5 | 0 ms | 0 kb | 0 | Skipped | |||||||
6 | 0 ms | 0 kb | 0 | Skipped | |||||||
7 | 0 ms | 0 kb | 0 | Skipped | |||||||
8 | 0 ms | 0 kb | 0 | Skipped | |||||||
9 | 0 ms | 0 kb | 0 | Skipped | |||||||
10 | 0 ms | 0 kb | 0 | Skipped | |||||||
11 | 0 ms | 0 kb | 0 | Skipped | |||||||
12 | 0 ms | 0 kb | 0 | Skipped | |||||||
13 | 0 ms | 0 kb | 0 | Skipped | |||||||
14 | 0 ms | 0 kb | 0 | Skipped | |||||||
15 | 0 ms | 0 kb | 0 | Skipped | |||||||
16 | 0 ms | 0 kb | 0 | Skipped |
Source Code
#include <stdio.h> int min(int a, int b) { return a < b ? a : b; } int max(int a, int b) { return a > b ? a : b; } int calculate_min_max_xor(int arr[], int n) { int min_max_xor = 0; // Count the number of occurrences of each bit for (int bit = 30; bit >= 0; bit--) { int count = 0; for (int i = 0; i < n; i++) { if (arr[i] & (1 << bit)) count++; } // For each bit position, if count is odd, then set the bit in the answer if (count % 2 == 1) min_max_xor |= (1 << bit); } return min_max_xor; } int main() { int n; int arr[n]; for (int i = 0; i < n; i++) { } int min_max_xor = calculate_min_max_xor(arr, n); return 0; }