My issue
find out runtime error
My code
#include <stdio.h>
#include <stdbool.h>
#define MAX_A 1000
int main() {
int s, a, b[2 * MAX_A], count[MAX_A];
bool isValid;
scanf("%d", &s);
while (s--) {
scanf("%d", &a);
for (int i = 0; i < 2 * a; i++) {
scanf("%d", &b[i]);
}
for (int i = 0; i < MAX_A; i++) {
count[i] = 0;
}
for (int i = 0; i < 2 * a; i++) {
count[b[i]]++;
}
isValid = true;
for (int i = 0; i < MAX_A; i++) {
if (count[i] > 2) {
isValid = false;
break;
}
}
if (isValid) {
printf("Yes\n");
} else {
printf("No\n");
}
}
return 0;
}
Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/CNDY