Submission
# | When | Author | Problem | Language | CPU | Memory | |
---|---|---|---|---|---|---|---|
20862 | 2024-06-13 00:00:55 | AHAMMED_99 | Warrior of Exoland | C | 3 ms | 3472 kb | Wrong Answer - 3 |
Source Code
#include <stdio.h> #include <stdbool.h> #define MAX_IDENTIFICATION 400001 #define MAX_N 200001 // Function to select the maximum number of warriors int maxWarriors(int warriors[][2], int N) { bool selectedNumbers[MAX_IDENTIFICATION] = {false}; // Array to keep track of selected identification numbers for (int i = 0; i < N; ++i) { // Add both identification numbers to the array selectedNumbers[warriors[i][0]] = true; selectedNumbers[warriors[i][1]] = true; } int count = 0; for (int i = 1; i < MAX_IDENTIFICATION; ++i) { if (selectedNumbers[i]) { count++; } } return count; } int main() { int N; int warriors[MAX_N][2]; for (int i = 0; i < N; ++i) { } int result = maxWarriors(warriors, N); return 0; }